•  
     

[Plugin CS 1.6] Loja de Facas bY and3rsoN~



#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <vault>
#include <hamsandwich>
#include <fvault>
#include <dhudmessage>

#pragma tabsize 0

#define is_valid_player(%1) (1 <= %1 <= 32)

new knife_model[33];

new const g_VAULTNAME[] = "Loja de Facas";
new const VERSION[] = "6.1"
new const AUTHOR[] = "and3rsoN~"

new iLevel[33];
new iXp[33];

new knife_on;

new MaxLevel;
new StartedLevel;

new Forward_spawn;
new Forward_levelup;
new ForwardReturn;

new g_dar[33],gidPlayer[33]

new const g_KnifeNames[][32] =
{
"Normal Faca",
"Skin name",
"Skin name",
"Skin name",
"Skin name",
"Skin name"
};

new const g_KnifevModels[][256] =
{
"models/v_knife.mdl",
"models/pasta name/v_skin_name.mdl",
"models/pasta name/v_skin_name.mdl",
"models/pasta name/v_skin_name.mdl",
"models/pasta name/v_skin_name.mdl",
"models/pasta name/v_skin_name.mdl"
}

native register_maxlevels( maxlevel = 99, started_xp_level = 500 );
native get_user_level( index );
native get_user_xp( index );
native set_user_xp(index, amount);
public plugin_init() {

register_plugin(g_VAULTNAME, VERSION, AUTHOR);
register_cvar("Armas_skins", VERSION, FCVAR_SERVER); // Find Servers on Game-Monitor
set_cvar_string("Armas_skins", VERSION); // Find Servers on Game-Monitor

register_maxlevels( 7, 350 );

register_logevent("planted", 3, "2=Planted_The_Bomb")
register_logevent("defused", 3, "2=Defused_The_Bomb")

knife_on = register_cvar( "knife_skins", "1" );

register_clcmd("say","HandleSay");
register_clcmd("say_team","HandleSay")

register_clcmd("say /loja", "menuSkinShop");
register_clcmd("say /niveis", "NiveisDosJogadores");
register_clcmd("say /skins", "menuSkins");

register_clcmd("say /doar", "menu_dar", ADMIN_IMMUNITY)
register_clcmd("quantidade_de_pontos", "jogador_pontos")

//Event's

register_event("CurWeapon","CurWeapon","be","1=1");
register_event( "DeathMsg", "EventDeathMsg", "a" );

//Ham's

RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawn", 1 );
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

//Forward's

Forward_levelup = CreateMultiForward( "forward_client_levelup", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL );
Forward_spawn = CreateMultiForward( "forward_client_spawn", ET_IGNORE, FP_CELL , FP_CELL, FP_CELL );

set_task(120.0, "Knifemessage", 0, _, _, "b")
set_task(120.0, "Levelmessage", 0, _, _, "b")

}

public plugin_precache() {

precache_model("models/pasta name/v_skin_name.mdl")
precache_model("models/pasta name/v_skin_name.mdl")
precache_model("models/pasta name/v_skin_name.mdl")
precache_model("models/pasta name/v_skin_name.mdl")
precache_model("models/pasta name/v_skin_name.mdl")

}

public plugin_natives( )
{
//Native's

register_library( "Armas-Skins" );

register_native( "register_maxlevels", "_register_maxlevels" );
register_native( "get_user_level", "_get_user_level" );
register_native( "set_user_level", "_set_user_level" );
register_native( "get_user_xp", "_get_user_xp" );
register_native( "set_user_xp", "_set_user_xp" );
}

public _register_maxlevels( plugin, params )
{
if( MaxLevel != 0 && StartedLevel != 0 )
{
return;
}
else
{
MaxLevel = get_param( 1 );
StartedLevel = get_param( 2 );
}
}

public _get_user_level( plugin, params )
{
return iLevel[ get_param( 1 ) ];
}

public _set_user_level( plugin, params )
{
iLevel[ get_param( 1 ) ] = max( get_param( 2 ), MaxLevel );

FlsahLevelUp( get_param( 1 ) );

SaveData( get_param( 1 ) );

LoadData( get_param( 1 ) );
}

public _get_user_xp( plugin, params )
{
return iXp[ get_param( 1 ) ];
}

public _set_user_xp( plugin, params )
{
iXp[ get_param( 1 ) ] = get_param( 2 );

CheckLevel( get_param( 1 ) );

SaveData( get_param( 1 ) );

LoadData( get_param( 1 ) );
}

public CheckLevel( id )
{
if( iLevel[id] == MaxLevel )
{
return;
}
else
{
new level = iLevel[id] > 0 ? iLevel[id] : 1;

new xp = level * StartedLevel;

if( iLevel[id] > 0 )
{
xp += ( xp * 4 / 2 );
}

while( iXp[id] >= xp )
{
iLevel[id]++;

ColorChat(0,"O Jogador ^4%s^1 Subiu para o^4 nivel^1:^4 %i^1!",get_player_name(id), iLevel[id]);

FlsahLevelUp(id);

ExecuteForward( Forward_levelup, ForwardReturn, id, iLevel[id], iXp[id] );

SaveData( id );

CheckLevel( id );

break;
}
}
}

public FlsahLevelUp( id )
{
set_dhudmessage(255, 0, 0, -1.0, 0.52, 1, 2.0, 3.0, 5.0);
show_dhudmessage(id, "[Server Name]");
set_dhudmessage(100, 100, 100, -1.0, 0.56, 1, 2.0, 3.0, 5.0 );
show_dhudmessage(id,"Parabens!^nSubiste para o nivel: %i.", iLevel[id]);
}



public HandleSay(id){

if (get_pcvar_num(knife_on) == 0)
{
ColorChat(id, "");
return PLUGIN_HANDLED;
}

new iMsg[200], iArgs[4][60];
new level = iLevel[id] > 0 ? iLevel[id] : 1;

new xp = level * StartedLevel;

if( iLevel[id] > 0 )
{
xp += ( xp * 4 / 2 );
}

read_argv(1,iMsg ,sizeof iMsg - 1);
parse(iMsg,iArgs[0],charsmax(iArgs[]),iArgs[1],charsmax(iArgs[]),iArgs[2],charsmax(iArgs[]),iArgs[3],charsmax(iArgs[]));

if (equali(iArgs[0],"/pontos") || equali(iArgs[0],"/nivel"))
{
new player = cmd_target(id,iArgs[1],CMDTARGET_NO_BOTS);

if (!player)
{
set_dhudmessage(255, 0, 0, 0.5, 0.62, 1, 2.0, 3.0, 5.0);
show_dhudmessage(id, "[Server Name]");
set_dhudmessage(100, 100, 100, 0.5, 0.66, 1, 2.0, 3.0, 5.0 );
show_dhudmessage(id, "Pontos: %i.^nNivel: %i", iXp[id], iLevel[id] );
}
}

return 0;
}

public defused()
{
new id = get_loguser_index()
new players[32], num
get_players(players, num )

if(num <= 4)
ColorChat(id, "^01Para receberes^3 MOEDAS^1 tem de haver^03 4 JOGADORES^01 no servidor!")
else{
if(get_user_flags(id))
{
iXp[id]+=3
ColorChat(id, "Nice, ganhaste ^3+3 MOEDAS^1 e^3+3PONTOS ^1por ^3DEFUSARES A BOMBA^1!")
}
}
}

public planted()
{
new id = get_loguser_index()
new players[32], num
get_players(players, num )

if(num <= 5)
ColorChat(id, "^01Para receberes^3 MOEDAS^1 tem de haver^03 5 JOGADORES^01 no servidor!")
else{

if(get_user_flags(id))
{
iXp[id]+=2
ColorChat(id, "Recebes-te ^3+2 MOEDAS^1 e^3+3PONTOS ^1 por^3 PLANTARES A BOMBA^01!")
}
}
}
stock get_loguser_index() {
new loguser[80], name[32]
read_logargv(0, loguser, 79)
parse_loguser(loguser, name, 31)

return get_user_index(name)
}

public EventDeathMsg(id)
{
new killer = read_data(1)
new victim = read_data(2)
new hs = read_data(3)
new szWeapon[ 20 ];
read_data( 4 , szWeapon , charsmax( szWeapon ) );

new g_iName[2][32]
get_user_name(killer, g_iName[0], 31)
get_user_name(victim, g_iName[1], 31)

// Suicide
if(killer == victim)
{
iXp[killer]-=3
ColorChat(killer, "Perdes-te^3 -3 MOEDAS^1 por te^3 SUICIDARES^1!")
CheckLevel(killer)
return PLUGIN_HANDLED
}

if( equal( szWeapon, "grenade" ) )
{
iXp[killer]+=2
ColorChat(killer, "Recebes-te^3 +2 MOEDAS^1 por matares^4 %s^1 de^3 HE^1!", g_iName[1])
}
else if( equal( szWeapon, "knife" ) )
{
iXp[killer]+=3
ColorChat(killer, "Recebes-te^3 +3 MOEDAS^1 por matares^4 %s^1 de^3 FACA^1!", g_iName[1])
}
else if(hs)
{

if(get_user_flags(killer))
{
iXp[killer]+=2
ColorChat(killer, "Recebes-te^3 +3 MOEDAS^1 por rebentares a ^3CABECA ^1de ^4 %s^1!", g_iName[1])
}
}
else
{
if(get_user_flags(killer))
{
iXp[killer]+=1
ColorChat(killer, "Recebes-te^3 +1 MOEDA^1 por matares^4 %s^1!", g_iName[1])
}
}
CheckLevel(killer);

SaveData(killer);

return PLUGIN_HANDLED
}

public FwdPlayerSpawn( id )
{
ExecuteForward( Forward_spawn, ForwardReturn, id, iLevel[id], iXp[id] );
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if( get_pcvar_num( knife_on ) == 0 )
return HAM_IGNORED;

if( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_KNIFE )
{
SetHamParamFloat(4, damage + knife_model[attacker]);

return HAM_HANDLED;
}

return HAM_IGNORED;
}

public menuSkinShop( id )
{
new menu = menu_create( "\w[\rServer Name\w]^n \wMenu da Loja", "SubMenuSkinShop" );

menu_additem( menu, "\wLoja", "1", 0 );
menu_additem( menu, "\wPontos", "2", 0 );
menu_additem( menu, "\wNiveis", "3", 0 );
menu_additem( menu, "\wMenu doar", "4", 0 );

menu_setprop( menu, MPROP_EXITNAME, "Sair" );
menu_setprop( menu, MPROP_NEXTNAME, "Seguinte" );
menu_setprop( menu, MPROP_BACKNAME, "Anterior" );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );

menu_display( id, menu, 0 );

return PLUGIN_HANDLED;
}

public SubMenuSkinShop( id, menu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new iAccess, iData[ 6 ], iName[ 64 ], iCallBack;
menu_item_getinfo( menu, item, iAccess, iData, charsmax( iData ), iName, charsmax( iName ), iCallBack );

new iKey = str_to_num( iData );

switch( iKey )
{
case 1:
{
menuSkins( id );
}

case 2:
{
client_cmd(id, "say /pontos");
}

case 3:
{
NiveisDosJogadores(id);
}

case 4:
{
menu_dar(id)
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}


public menuSkins( id )
{
new menu = menu_create( "\r[\wServer Name\r]^n \wMenu Skins", "SubMenu" );

menu_additem( menu, "\wFacas", "1", 0 );

menu_setprop( menu, MPROP_EXITNAME, "\wSair" );
menu_setprop( menu, MPROP_NEXTNAME, "\wSeguinte" );
menu_setprop( menu, MPROP_BACKNAME, "\wAnterior" );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );

menu_display( id, menu, 0 );

return PLUGIN_HANDLED;
}

public SubMenu( id, menu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new iAccess, iData[ 6 ], iName[ 64 ], iCallBack;
menu_item_getinfo( menu, item, iAccess, iData, charsmax( iData ), iName, charsmax( iName ), iCallBack );

new iKey = str_to_num( iData );

switch( iKey )
{
case 1:
{
KnifeSkinsMenu(id);
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}

public KnifeSkinsMenu(id) {

if (get_pcvar_num(knife_on) == 0)
{
ColorChat(id, "");
return PLUGIN_HANDLED;
}

new szItem[256], szKnifeA[50], szKnifeB[50], szKnifeC[50], szKnifeD[50], szKnifeE[50];

new level = iLevel[id] > 0 ? iLevel[id] : 1;

new xp = level * StartedLevel;

if( iLevel[id] > 0 )
{
xp += ( xp * 4 / 2 );
}

formatex(szItem, charsmax(szItem), "\w[\rServer Name\w] \wLoja de Facas ^n\yNivel: \r%d \w- \yPontos: \r%d^n\yPagina:", iLevel[id], iXp[id]);
formatex(szKnifeA, charsmax(szKnifeA),"%s", iLevel[id] >= 1 ? "\wNome da Faca \d[\yComprada\d]" : "\d[\yPor Comprar\d]");
formatex(szKnifeB, charsmax(szKnifeB),"%s", iLevel[id] >= 2 ? "\wNome da Faca \d[\yComprada\d]" : "\d[\yPor Comprar\d]");
formatex(szKnifeC, charsmax(szKnifeC),"%s", iLevel[id] >= 3 ? "\wNome da Faca \d[\yComprada\d]" : "\d[\yPor Comprar\d]");
formatex(szKnifeD, charsmax(szKnifeD),"%s", iLevel[id] >= 4 ? "\wNome da Faca \d [\yComprada\d]" : "\d[\yPor Comprar\d]");
formatex(szKnifeE, charsmax(szKnifeE),"%s", iLevel[id] >= 5 ? "\wNome da Faca \d[\yComprada\d]" : "\d[\yPor Comprar\d]");

new menu = menu_create( szItem, "KnifeSkinsMenu_Handler" );
menu_additem(menu, "\wNormal Faca \d[\yAtual\d]", "", 0 );
menu_additem(menu, szKnifeA, "", iLevel[id] >= 1 ? 0 : 1);
menu_additem(menu, szKnifeB, "", iLevel[id] >= 2 ? 0 : 1);
menu_additem(menu, szKnifeC, "", iLevel[id] >= 3 ? 0 : 1);
menu_additem(menu, szKnifeD, "", iLevel[id] >= 4 ? 0 : 1);
menu_additem(menu, szKnifeE, "", iLevel[id] >= 5 ? 0 : 1);

menu_setprop(menu, MPROP_EXITNAME, "\wSair" );
menu_setprop(menu, MPROP_NEXTNAME, "\wSeguinte" );
menu_setprop(menu, MPROP_BACKNAME, "\wAnterior" );
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
menu_display(id, menu, 0 );

return PLUGIN_HANDLED;
}

public KnifeSkinsMenu_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

SetKnife(id, item);
ColorChat(id, "Adquiris-te a compra da ^3%s^1!", g_KnifeNames[item]);

SaveData(id);
return PLUGIN_HANDLED;
}

public SetKnife(id, item) {

knife_model[id] = item

new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if ( Weapon != CSW_KNIFE )
return PLUGIN_HANDLED

new vModel[56],pModel[56]

if (get_pcvar_num(knife_on) == 0)
{
format(vModel,55,"models/v_knife.mdl")
return PLUGIN_HANDLED;
}

format(vModel,55, g_KnifevModels[item])
format(pModel,55,"models/p_knife.mdl")
entity_set_string(id, EV_SZ_viewmodel, vModel)
entity_set_string(id, EV_SZ_weaponmodel, pModel)

return PLUGIN_HANDLED;
}

public NiveisDosJogadores(id)
{
if (get_pcvar_num(knife_on) == 0)
{
ColorChat(id, "");
return PLUGIN_HANDLED;
}

new some[256], menu;

static players[32],szTemp[10],pnum;
get_players(players,pnum,"ch");

formatex(some,255,"\w[\rServer Name\w]^n \wNiveis Jogadores");

menu = menu_create(some,"NiveisMenu_Handler");

for (new i; i < pnum; i++)
{
new level = iLevel[players] > 0 ? iLevel[players] : 1;

new xp = level * StartedLevel;

if( iLevel[players] > 0 )
{
xp += ( xp * 4 / 2 );
}

formatex(some,256,"\yNome:\w %s \y(\dNivel\w: \r%i\y) \w- \y(\dPontos\w: \r%i\y)", get_player_name(players), iLevel[players], iXp[players]);
num_to_str(players,szTemp,charsmax(szTemp));
menu_additem(menu, some, szTemp);
}

menu_setprop(menu, MPROP_EXITNAME, "\wSair" );
menu_setprop(menu, MPROP_NEXTNAME, "\wSeguinte" );
menu_setprop(menu, MPROP_BACKNAME, "\wAnterior" );
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL );
menu_display(id, menu);

return PLUGIN_HANDLED;
}

public NiveisMenu_Handler(id,menu, item){
if (item == MENU_EXIT)
{
menu_destroy(menu);
return;
}

new data[6] ,szName[64],access,callback;

menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback);

new player = str_to_num(data);

new level = iLevel[player] > 0 ? iLevel[player] : 1;

new xp = level * StartedLevel;

if( iLevel[player] > 0 )
{
xp += ( xp * 4 / 2 );
}

ColorChat(id,"^1Nome:^3 %s ^1| ^4Nivel^1: ^3%i^1 | ^4Pontos ^3%i^1.",get_player_name(player), iLevel[player], iXp[player]);
NiveisDosJogadores(id);
}

public CurWeapon(id)
{
// Set Knife Model
SetKnife(id, knife_model[id])
}

public menu_dar(id)
{
if (!(get_user_flags(id) & ADMIN_IMMUNITY))
{
ColorChat(id, "Nao tens acesso a este^04 menu^01.")
return PLUGIN_HANDLED
}

else
{
static opcion[64]

formatex(opcion, charsmax(opcion),"\yAdministrar Pontos:")
new iMenu = menu_create(opcion, "menu_dar_sub")

formatex(opcion, charsmax(opcion),"\yDoar ao Jogador")
menu_additem(iMenu, opcion, "1")

formatex(opcion, charsmax(opcion),"\yTirar ao Jogador")
menu_additem(iMenu, opcion, "2")

menu_setprop(iMenu, MPROP_EXITNAME, "\wSair" );
menu_setprop(iMenu, MPROP_NEXTNAME, "\wSeguinte" );
menu_setprop(iMenu, MPROP_BACKNAME, "\wAnterior" );
menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, iMenu, 0)
}
return PLUGIN_HANDLED
}

public menu_dar_sub(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback

menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)

new Key = str_to_num(Data)

switch (Key)
{
case 1:
{
g_dar[id] = 1
pontosjogador(id);
}
case 2:
{
g_dar[id] = 0
pontosjogador(id);
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}

public pontosjogador(id)
{
static opcion[64]
if(g_dar[id]==1)
formatex(opcion, charsmax(opcion),"\yJogadores^n\d[\rDoar Pontos\d]")
else if(g_dar[id]==0)
formatex(opcion, charsmax(opcion),"\yJogadores^n\d[\rTirar Pontos\d]")
new iMenu = menu_create(opcion, "pontosjogador_sub")

new players[32], pnum, tempid
new szName[32], szTempid[10]

get_players(players, pnum, "c")

for( new i; i<pnum; i++ )
{
tempid = players

get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)

formatex(opcion, charsmax(opcion), "\w%s \y( %i Pontos )", szName, iXp[tempid])
menu_additem(iMenu, opcion, szTempid, 0)
}

menu_setprop(iMenu, MPROP_EXITNAME, "\wSair" );
menu_setprop(iMenu, MPROP_NEXTNAME, "\wSeguinte" );
menu_setprop(iMenu, MPROP_BACKNAME, "\wAnterior" );
menu_display(id, iMenu)
return PLUGIN_HANDLED
}

public pontosjogador_sub(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu)
menu_dar(id)
return PLUGIN_HANDLED
}

new Data[6], Name[64]
new Access, Callback
menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)

new tempid = str_to_num(Data)

gidPlayer[id] = tempid
client_cmd(id, "messagemode quantidade_de_pontos")

menu_destroy(menu)
return PLUGIN_HANDLED
}

public jogador_pontos(id)
{
new say[300]
read_args(say, charsmax(say))

remove_quotes(say)

if(!is_str_num(say) || equal(say, ""))
return PLUGIN_HANDLED

pontos_jogador(id, say)

return PLUGIN_CONTINUE
}

pontos_jogador(id, say[]) {
new amount = str_to_num(say)
new victim = gidPlayer[id]

new vname[32], dname[32]

if(victim > 0)
{
get_user_name(victim, vname, 31)
get_user_name(id, dname, 31)

if(g_dar[id]==1)
{
iXp[victim]+=amount
CheckLevel( victim );
ColorChat(0, "^3[ADMIN]:^4 %s^1 deu^04 %i ^3PONTOS ^01 a^04 %s^01.", dname, amount, vname)
}
else if(g_dar[id]==0)
{
if(amount > iXp[victim])
{
iXp[victim] = 0
CheckLevel( victim );
ColorChat(0, "^3[ADMIN]:^4 %s^01 tirou todos as^3 PONTOS^01 de^04 %s^01.", dname, vname)
}
else
{
iXp[victim]-=amount
CheckLevel( victim );
ColorChat(0, "^3[ADMIN]:^4 %s^01 tirou^04 %i ^3PONTOS^01 a^04 %s^01.", dname, amount, vname)
}

}
CheckLevel( victim );
SaveData( victim );
//Save_MySql(victim)
}

return PLUGIN_HANDLED
}

public client_disconnect(id) {

if(task_exists(id)){
remove_task(id)
}
SaveData(id);
}

public Knifemessage(id) {

if (get_pcvar_num(knife_on) == 0)
return PLUGIN_HANDLED;

ColorChat(0, "^1Comandos disponiveis: ^4/loja^1, ^4/skins^1 e ^4/niveis^1.");
return PLUGIN_HANDLED;
}

public Levelmessage(id) {

if (get_pcvar_num(knife_on) == 0)
return PLUGIN_HANDLED;

ColorChat(0,"Mensagem a seu gosto :D");
return PLUGIN_HANDLED;
}

public client_putinserver(id) LoadData(id);

public SaveData(id){

new authid[32]
get_user_authid(id, authid, 31)

new vaultkey[64]
new vaultdata[64]

format(vaultkey, 63, "KNIFEMOD_%s", authid)
format(vaultdata, 63, "%d", knife_model[id])
set_vaultdata(vaultkey, vaultdata)

new data[ 16 ];

get_user_authid( id, authid, sizeof( authid ) - 1 );

formatex( data, sizeof( data ) - 1, "%d %d", iLevel[id], iXp[id] );

fvault_set_data(g_VAULTNAME, authid, data );

return;


}

public LoadData(id){

new authid[32]
get_user_authid(id,authid,31)

new vaultkey[64], vaultdata[64]

format(vaultkey, 63, "KNIFEMOD_%s", authid)
get_vaultdata(vaultkey, vaultdata, 63)
knife_model[id] = str_to_num(vaultdata)

new data[ 16 ], szLevel[ 8 ], szXp[ 8 ];

get_user_authid( id, authid, sizeof( authid ) - 1 );

if( fvault_get_data(g_VAULTNAME, authid, data, sizeof( data ) - 1 ) )
{
strbreak( data, szLevel, sizeof( szLevel ) - 1, szXp, sizeof( szXp ) - 1 );

iLevel[id] = str_to_num( szLevel );
iXp[id] = str_to_num( szXp );

return;
}
else
{
iLevel[id] = 0;
iXp[id] = 0;

return;
}
}

stock get_player_name(id){
static szName[32];
get_user_name(id,szName,31);
return szName;
}

stock ColorChat( const id, const string[ ], { Float, Sql, Resul, _ } : ... )
{
new msg[ 191 ], players[ 32 ], count = 1;

static len;
len = formatex( msg, charsmax( msg ), "^x04[Server Name]^x01 " );
vformat( msg[ len ], charsmax( msg ) - len, string, 3 );

if( id )
players[ 0 ] = id;
else
get_players( players,count,"ch" );

for( new i = 0; i < count; i++ )
{
if( is_user_connected( players ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _ , players[ i ] );
write_byte( players[ i ] );
write_string( msg );
message_end( );
}
}
}
Página inicial