Page 1 of 1

[rezolvat!]cerere plugin banca

Posted: 07 Jan 2019, 22:16
by Zppp.Mihai94
Plugin Cerut:
| Afiseaza codul
#include <amxmodx> 
#include <amxmisc> 
#include <nvault> 
#include <fakemeta> 
#include <zombie_plague_special> 

static const version[] = "0.8b"; 
static const plugin[] = "Banca ZP"; 
static const defaultPacks = 5; 

enum pcvar 
{ 
enable = 0, 
cap, 
} 

new pcvars[pcvar]; 
new bankstorage[33]; 
new saveAuthID[33];  

new thinkobj; 
new gvault; 
new spreeToggle; 
new g_maxplayers // max players counter 
new g_msgSayText // Message IDs vars 


public SaveData() 
{ 
for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue;	
client_disconnect(o); //bankstorage[o] = 0; 
} 
} 

public plugin_init() 
{ 
register_plugin(plugin, version, "Random1"); 
register_event("HLTV", "event_round_start", "a", "1=0", "2=0"); 

//Language files 
//register_dictionary("zp_bank.txt") 

pcvars[enable] =	register_cvar("zp_bank", "1"); 
pcvars[cap] =	register_cvar("zp_bank_limit", "10000000000"); 

gvault = nvault_open("Zombie Bank"); 

g_maxplayers = get_maxplayers()	// Get Max Players 
g_msgSayText = get_user_msgid("SayText")	//Settings variables 

spreeToggle = 0; 

if ( get_pcvar_num(pcvars[cap]) > 2147483646 ) 
{ 
set_pcvar_num(pcvars[cap], 2147483646); 
server_print("[%s] Due to a 32 bit restriction in perl zp_ammo_limit reset based on restriction", plugin); 
} 

register_clcmd("say", "handle_say"); 
register_clcmd("say_team", "handle_say"); 
register_clcmd("zp_setcredite", "givex_cmd", ADMIN_RCON, "<Nume> <Suma>, cu aceasta comanda poti da credite la jucatori"); 
register_clcmd("zp_luatcredite", "takex_cmd", ADMIN_RCON, "<Nume> <Suma>, cu aceasta comanda poti lua credite de la jucatori"); 
register_concmd("zp_reset_bank", "prune_task", ADMIN_RCON, "<Timp> in zile. timp 0 = stergeti creditele la toti jucatorii"); 
//register_clcmd("zp_spendingspree", "spending_cmd", ADMIN_RCON, "activati sau dezactiviati modul de distrugere a creditelor."); 

thinkobj = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); 
if ( pev_valid(thinkobj) ) 
{ 
set_pev(thinkobj, pev_classname, "advertisement_loop"); 
set_pev(thinkobj, pev_nextthink, get_gametime() + 240.0); 
register_forward(FM_Think, "fourmin_think"); 
} 
} 
public fourmin_think(ent) 
{ 
if ( ent != thinkobj ) return FMRES_IGNORED; 
if ( !get_pcvar_num(pcvars[enable]) ) return FMRES_IGNORED; 

zp_colored_print(0, "^x04[%s]^x01 Creditele sunt salvate Automat pe Server.", plugin); 
//zp_colored_print(0, "^x04[%s]^x01 Nu este necesara comanda /deposit pentru a putea Salva sau Retrage.", plugin); 

set_pev(ent, pev_nextthink, get_gametime() + 240.0); 

return FMRES_HANDLED; 
} 

public plugin_natives() 
{ 
//natives 
register_native("zp_bank_get_packs", "getAmmoPacks", 1) 
register_native("zp_bank_set_packs", "setAmmoPacks", 1) 
} 

public plugin_end() { 
server_print("[%s] Saving your money. ", plugin); 

for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 
save_data(o); 
} 

nvault_close(gvault); 
} 

public getAmmoPacks(id) 
{ 
if ( spreeToggle == 0) 
{ 
return zp_get_user_ammo_packs(id); 
} else { 
return bankstorage[id]; 
} 

return -1; 
} 
public setAmmoPacks(id, amnt) 
{ 
if ( spreeToggle == 0) 
{ 
zp_set_user_ammo_packs(id, amnt); 
} else { 
bankstorage[id] = amnt; 
} 
} 

public handle_say(id) 
{ 
if ( !get_pcvar_num(pcvars[enable]) ) return PLUGIN_CONTINUE; 

new text[70], arg1[32], arg2[32], arg3[6]; 
read_args(text, sizeof(text)-1); 
remove_quotes(text); 
arg1[0] = '^0'; 
arg2[0] = '^0'; 
arg3[0] = '^0'; 
parse(text, arg1, sizeof(arg1)-1, arg2, sizeof(arg2)-1, arg3, sizeof(arg3)-1); 

// if the chat line has more than 2 words, we're not interested at all 
if (arg3[0] == 0) 
{ 
//strip forward slash if present 
if ( equali(arg1, "/", 1) ) format(arg1, 31, arg1[1]); 

if ( equali(arg1, "deposit", 7) || equali(arg1, "send", 4) || equali(arg1, "store", 5) || equali(arg1, "withdraw",  || equali(arg1, "take", 4) || equali(arg1, "retrieve", ) 
{ 
zp_colored_print(id, "^x04[%s]^x01 Depunerea si retragerea nu sunt necesare.", plugin); 
zp_colored_print(id, "^x04[%s]^x01 Creditele sunt Salvate/Stocate Automat.", plugin); 
return PLUGIN_CONTINUE;	
} 
else if ( equali(arg1, "mybank", 6) || equali(arg1, "account", 7) || equali(arg1, "bank", 4) ) 
{ 
if ( arg2[0] == 0 ) { 
zp_colored_print(id, "^x04[%s]^x01 In prezent contul tau are %d De Credite in el.",plugin, getAmmoPacks(id)); 
return PLUGIN_HANDLED; 
} 
else { 
new player = cmd_target(id,arg2,2); 
if ( !player ) return PLUGIN_CONTINUE; 
zp_colored_print(id, "^x04[%s]^x01 %s are %d de Credite.", plugin, arg2, getAmmoPacks(player)); 
return PLUGIN_HANDLED; 
} 
} 
} 

return PLUGIN_CONTINUE; 
} 

public prune_task(id,level,cid) 
{ 
if (!cmd_access(id,level,cid,1)) { 
console_print(id,"Nu aveti Acces la Aceasta Comanda."); 
return; 
} 
new connum = read_argc() 
if (connum > 2) { 
console_print(id,"Prea multe argumente Furnizate."); 
return; 
} 
if ( connum == 1 ) return;	//person just typed command to see the description 
//we check this because str_to_num will return 0 on an empty string thus doing the same thing as "zp_reset_bank 0" which does a full reset 

static adminname[32]; 
get_user_name(id, adminname, 31); 
new arg[10]; 
read_argv(1,arg,9); 
new timeamnt = str_to_num(arg); 

if ( timeamnt == 0 ) { 
nvault_prune(gvault, 0, 0); 

zp_colored_print(0, "^x04[%s]^x01 Banca a fost jefuita !, acei Hoti murdari ți-au furat toate Creditele!", plugin); 
log_amx("[%s] Banca a fost resetata (complet) De Adminul: %s", plugin, adminname); 
//for those who are in the server at the time of prune need to whipe out there stuff as well 
for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 

bankstorage[o] = 0; 
if (spreeToggle == 0) zp_set_user_ammo_packs(o, 0); 
} 
} 
else { 

nvault_prune(gvault, 0, get_systime() - (timeamnt * 86400)); 

log_amx("[%s] banca a fost oprita %d zile%s de Adminul: %s", plugin, timeamnt, timeamnt == 1 ? "" : "'s", adminname);	
} 
} 

public takex_cmd(id, player) 
{ 
if ( read_argc() > 3 ) return PLUGIN_HANDLED; 

new arg1[32], arg2[10], amount, curAmount; 
read_argv(1, arg1, sizeof(arg1) - 1); 
read_argv(2, arg2, sizeof(arg2) - 1); 

amount = str_to_num(arg2); 
new target = cmd_target(0, arg1, 2); 

if ( target == 0 ) 
{ 
//couldnt find them 
zp_colored_print(id, "^x04[%s]^x01 Nu am putut gasi acest Jucator."); 
return PLUGIN_HANDLED; 

} else { 

//we found them! 
new targetName[64]; 
new szNume[32]; 
//new szText[ 164 ]; 
get_user_name(target, targetName, 63); 
get_user_name(id, szNume, charsmax(szNume)); 
curAmount = getAmmoPacks(target); 

if ( amount > curAmount ) 
{ 
if (curAmount == 0) 
{ 
zp_colored_print(id, "^x04[%s]^x01 %s are %d De Credite!", plugin , targetName, curAmount); 
return PLUGIN_HANDLED; 
} else { 
zp_colored_print(id, "^x04[%s]^x01 %s doar a avut %d De Credite., asa ca a fost Eliminat!", plugin , targetName, curAmount); 
} 

//if (spreeToggle == 0) store_cash(target, curAmount); 
setAmmoPacks(target, 0); 
amount = curAmount; 

} else { 

//if (spreeToggle == 0) store_cash(target, amount); 
setAmmoPacks(target, curAmount - amount); 
} 

zp_colored_print(id, "^x04[%s]^x01 Adminul %s a Retras de la %s o suma de %d de Credite!", plugin , szNume, targetName, amount ); 
zp_colored_print(target, "^x04[%s]^x01 Adminul %s Ti-a retras o suma de %d de Credite!", plugin , szNume,  amount ); 
log_to_file( "addons/amxmodx/logs/credite_nivel/credite_zp_banca.log", "[ZP BANK] Adminul %s a retras de la %s o suma de %d de Credite.", szNume, targetName, amount);
return PLUGIN_HANDLED; 
} 

return PLUGIN_HANDLED; 
} 

public givex_cmd(id, player) 
{	
if ( read_argc() > 3 ) return PLUGIN_HANDLED; 

new arg1[32], arg2[10], amount; 
read_argv(1, arg1, sizeof(arg1) - 1); 
read_argv(2, arg2, sizeof(arg2) - 1); 

amount = str_to_num(arg2); 
new target = cmd_target(0, arg1, 2); 

if ( target == 0 ) 
{ 
//couldnt find them 
zp_colored_print(id, "^x04[%s]^x01 Nu am putut gasi Jucatorul Solicitat.", plugin); 

return PLUGIN_HANDLED; 

} else { 
 
//we found them! 
//bankstorage[target] += amount; 

setAmmoPacks(target, getAmmoPacks(target) + amount); 
//if( spreeToggle == 1) store_cash(target, amount); 

if(id == target) 
{ 
zp_colored_print(id, "^x04[%s]^x01 V-ati dat singur %d de Credite!", plugin, amount ); 
} else { 
new targetName[64]; 
new szNume[32];
get_user_name(target, targetName, 63); 
get_user_name(id, szNume, charsmax(szNume));  

zp_colored_print(id, "^x04[%s]^x01 Adminul %s i-a Adaugat lui %s o Suma de %d de Credite!", plugin , szNume, targetName, amount ); 
zp_colored_print(target, "^x04[%s]^x01 Adminul %s ti-a oferit suma de %d de Credite!", plugin , szNume, amount ); 
log_to_file( "addons/amxmodx/logs/credite_nivel/credite_zp_banca.log", "[ZP BANK] Adminul %s a dat lui %s o suma de %d de Credite.", szNume, targetName, amount); 
} 
return PLUGIN_HANDLED; 
} 
return PLUGIN_HANDLED; 
} 

/* 
public spending_cmd(id) 
{ 
if ( read_argc() > 2 ) 
{ 
client_print(id, print_console, "[%s] Context Incorect.", plugin); 
return PLUGIN_HANDLED; 
} 

new arg1[32], spree; 
read_argv(1, arg1, sizeof(arg1) - 1); 
spree = str_to_num(arg1); 

if ( spree == 0 ) 
{ 
//disable our spending spree 
//first check if it was previously enabled 
if ( spreeToggle == 0) return PLUGIN_HANDLED; 

//end our spending spree 
zp_colored_print(0, "^x04[%s]^x01 Sindromul de Chelitura sa terminat.", plugin); 
client_print(id, print_console, "[%s] Ai dezactivat Acesta Oportunitate.", plugin); 

//remove everyone's extra money 
for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 

//re-withdraw everyone's money 
zp_set_user_ammo_packs(o, bankstorage[o]); 
bankstorage[o] = 0; 
} 

spreeToggle = 0; 
return PLUGIN_HANDLED; 

} else { 

//enable it 
if ( spreeToggle == 1) return PLUGIN_HANDLED; 

for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 

//store our money first 
bankstorage[o] = zp_get_user_ammo_packs(o); 

//set a high amount of money for everyone 
zp_set_user_ammo_packs(o, get_pcvar_num(pcvars[cap])); 
} 

zp_colored_print(0, "^x04[%s]^x01 Spreea de cheltuieli este Activ! Fii salbatic!", plugin); 
client_print(id, print_console, "[%s] A permis sa cheltuiasca sindrofie.", plugin); 

spreeToggle = 1; 
return PLUGIN_HANDLED; 
} 

return PLUGIN_HANDLED; 
} 
*/ 

//public zp_user_disconnect_pre(id) 
public client_disconnect(id) 
{	
//fixed bug here, people could spend all their money, and then not have it save the 0 remaining 
save_data(id); 

} 

//public zp_user_connect_post(id) 
public client_putinserver(id) 
{	
get_user_name(id,saveAuthID[id],34); 

bankstorage[id] = 0;	//clear residual before loading 
zp_set_user_ammo_packs(id, 0); //clear 

retrieve_data(id); 
} 

public event_round_start() 
{ 
if (spreeToggle == 1) 
{ 
//replenish everyone's money 
for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 
zp_set_user_ammo_packs(o, get_pcvar_num(pcvars[cap])); 
} 

set_task(2.2, "spreeAlert") 
} 

for( new o = 1; o < 33; o++) 
{ 
if ( !is_user_connected(o) || is_user_bot(o) ) continue; 
save_data(o); 
} 
} 

public spreeAlert() 
{ 
zp_colored_print(0, "^x04[%s]^x01 Spreea de cheltuieli este Activat! Fii salbatic!", plugin); 
} 

store_cash(id, amnt) 
{ 
if ( !get_pcvar_num(pcvars[enable]) ) return; 

if ( amnt == -1 ) 
{ 
bankstorage[id] += zp_get_user_ammo_packs(id); 
zp_set_user_ammo_packs(id, 0); 
checkmax(id); 
} 
else if ( amnt > 0 ) 
{	
new temp = zp_get_user_ammo_packs(id); 
new limit = get_pcvar_num(pcvars[cap]); 
if ( temp >= amnt ) 
{	
if ( bankstorage[id] + amnt <= limit ) 
{ 
bankstorage[id] += amnt 
zp_set_user_ammo_packs(id, temp - amnt); 
} 
else 
{ 
new overflow = bankstorage[id] + amnt - limit; 
bankstorage[id] = limit; 
zp_set_user_ammo_packs(id, temp - amnt + overflow); 
zp_colored_print(id, "^x04[%s]^x01 Contul tau. a atins capacitatea maxima de %d de Credite", plugin, limit); 
zp_colored_print(id, "^x04[%s]^x01 Numai %d din %d pe care ati specificat ca ati depus-o", plugin, 
amnt - overflow, amnt); 
} 
} 
else 
zp_colored_print(id, "^x04[%s]^x01 Suma specificata(%d) este mai mare decat numarul curent al Creditelor(%d)", plugin, 
amnt, temp);	
} 
else 
take_cash(id, -amnt); 
} 

take_cash(id, amnt) 
{ 
if ( !get_pcvar_num(pcvars[enable]) ) return; 

if ( amnt == 0 ) return;	//otherwise a non terminal loop is possible 

if ( amnt == -1 ) 
{ 
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + bankstorage[id]) 
bankstorage[id] = 0; 
} 
else if ( amnt > 0 ) 
{ 
if ( bankstorage[id] >= amnt ) 
{ 
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + amnt); 
bankstorage[id] -= amnt; 
} 
else { 
/* 
zp_colored_print(id, "^x04[%s]^x01 Suma specificata(%d) este mai mare decat ceea ce este în banca(%d)", plugin, 
amnt, bankstorage[id]); 
*/ 
}	
} 
else store_cash(id, -amnt); 
} 

checkmax(id) 
{ 
if ( zp_get_user_ammo_packs(id) > get_pcvar_num(pcvars[cap]) ) 
zp_set_user_ammo_packs(id, get_pcvar_num(pcvars[cap])); 

else if ( zp_get_user_ammo_packs(id) < 0 ) 
zp_set_user_ammo_packs(id, 0); 
} 

save_data(id) 
{ 
//new AuthID[35]; 
//get_user_authid(id,AuthID,34); 
new vaultkey[40],vaultdata[13]; 

formatex( vaultkey, 39, "%s", saveAuthID[id]); 
formatex( vaultdata, 12, "%i", getAmmoPacks(id)); 

nvault_set(gvault, vaultkey, vaultdata); 

//clear data 
//bankstorage[id] = 0;	//clear residual before loading 
//zp_set_user_ammo_packs(id, 0); //clear	
} 

retrieve_data(id) 
{ 
//new AuthID[35]; 
//get_user_authid(id,AuthID,34); 
new vaultkey[40], vaultdata[13]; 

format(vaultkey, 39, "%s", saveAuthID[id]); 

nvault_get(gvault, vaultkey, vaultdata, 12); 

zp_set_user_ammo_packs(id, str_to_num(vaultdata)); 

checkmax(id); 

//if they have less then the default, be nice and give them some 
#if !defined THERE_IS_NO_GOD 
if ( zp_get_user_ammo_packs(id) < defaultPacks ) zp_set_user_ammo_packs(id, defaultPacks); 
#endif 

if ( spreeToggle == 1 ) 
{ 
bankstorage[id] = zp_get_user_ammo_packs(id); 
zp_set_user_ammo_packs(id, get_pcvar_num(pcvars[cap])); 
} 

} 

/*================================================================================ 
--The following are copied directly from zombie_plague, no reinventing wheels... 
[Shared Functions] 
=================================================================================*/ 
zp_colored_print(target, const message[], any:...) 
{ 
static buffer[512], i, argscount 
argscount = numargs() 

// Send to everyone 
if (!target) 
{ 
static player 
for (player = 1; player <= g_maxplayers; player++) 
{ 
// Not connected 
if (!is_user_connected(player)) 
continue; 

// Remember changed arguments 
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies 
changedcount = 0 

// Replace LANG_PLAYER with player id 
for (i = 2; i < argscount; i++) 
{ 
if (getarg(i) == LANG_PLAYER) 
{ 
setarg(i, 0, player) 
changed[changedcount] = i 
changedcount++ 
} 
} 

// Format message for player 
vformat(buffer, sizeof buffer - 1, message, 3) 

// Send it 
message_begin(MSG_ONE, g_msgSayText, _, player) 
write_byte(player) 
write_string(buffer) 
message_end() 

// Replace back player id's with LANG_PLAYER 
for (i = 0; i < changedcount; i++) 
setarg(changed, 0, LANG_PLAYER) 
} 
} 

// Send to specific target 
else 
{ 
/* 
// Replace LANG_PLAYER with player id 
for (i = 2; i < argscount; i++) 
{ 
if (getarg(i) == LANG_PLAYER) 
setarg(i, 0, target) 
} 
*/ 

// Format message for player 
vformat(buffer, sizeof buffer - 1, message, 3) 

// Send it 
message_begin(MSG_ONE, g_msgSayText, _, target) 
write_byte(target) 
write_string(buffer) 
message_end() 
} 
}

Descriere (adica ce face el mai exact): ca sa nu mai fac alt topic, am acest plugin de dat si de luat credite de la jucatori, iar pentru salvat creditele am alta banca pe baza de date mysql se poate scoate din acest plugin functia nvalut? si sa ramana doar pentru a dat si a lua credite.
Serverul ruleaza (HLDS/ReHLD): rehlds
Versiune AMX Mod X: 1.8.3
Modul Serverului: zombie plague

Re: cerere plugin banca

Posted: 07 Jan 2019, 22:31
by levin
| Afiseaza codul
#include <amxmodx> 
#include <amxmisc> 
#include <zombie_plague_special> 

static const version[] = "0.8b"; 
static const plugin[] = "Banca ZP"; 

public plugin_init() 
{ 
register_plugin(plugin, version, "Random1"); 

register_clcmd("zp_setcredite", "givex_cmd", ADMIN_RCON, "<Nume> <Suma>, cu aceasta comanda poti da credite la jucatori"); 
register_clcmd("zp_luatcredite", "takex_cmd", ADMIN_RCON, "<Nume> <Suma>, cu aceasta comanda poti lua credite de la jucatori"); 
}

public plugin_natives() 
{ 
//natives 
register_native("zp_bank_get_packs", "getAmmoPacks", 1) 
register_native("zp_bank_set_packs", "setAmmoPacks", 1) 
} 

public getAmmoPacks(id) 
{ 
return zp_get_user_ammo_packs(id);

} 
public setAmmoPacks(id, amnt) 
{ 
zp_set_user_ammo_packs(id, amnt); 
} 


public takex_cmd(id, player) 
{ 
if ( read_argc() > 3 ) return PLUGIN_HANDLED; 

new arg1[32], arg2[10], amount, curAmount; 
read_argv(1, arg1, sizeof(arg1) - 1); 
read_argv(2, arg2, sizeof(arg2) - 1); 

amount = str_to_num(arg2); 
new target = cmd_target(0, arg1, 2); 

if ( target == 0 ) 
{ 
//couldnt find them 
zp_colored_print(id, "^x04[%s]^x01 Nu am putut gasi acest Jucator."); 
return PLUGIN_HANDLED; 

} else { 

//we found them! 
new targetName[64]; 
new szNume[32]; 
//new szText[ 164 ]; 
get_user_name(target, targetName, 63); 
get_user_name(id, szNume, charsmax(szNume)); 
curAmount = getAmmoPacks(target); 

if ( amount > curAmount ) 
{ 
if (curAmount == 0) 
{ 
zp_colored_print(id, "^x04[%s]^x01 %s are %d De Credite!", plugin , targetName, curAmount); 
return PLUGIN_HANDLED; 
} else { 
zp_colored_print(id, "^x04[%s]^x01 %s doar a avut %d De Credite., asa ca a fost Eliminat!", plugin , targetName, curAmount); 
} 

setAmmoPacks(target, 0); 
amount = curAmount; 

} else { 

setAmmoPacks(target, curAmount - amount); 
} 

zp_colored_print(id, "^x04[%s]^x01 Adminul %s a Retras de la %s o suma de %d de Credite!", plugin , szNume, targetName, amount ); 
zp_colored_print(target, "^x04[%s]^x01 Adminul %s Ti-a retras o suma de %d de Credite!", plugin , szNume,  amount ); 
log_to_file( "addons/amxmodx/logs/credite_nivel/credite_zp_banca.log", "[ZP BANK] Adminul %s a retras de la %s o suma de %d de Credite.", szNume, targetName, amount);
return PLUGIN_HANDLED; 
} 

return PLUGIN_HANDLED; 
} 

public givex_cmd(id, player) 
{	
if ( read_argc() > 3 ) return PLUGIN_HANDLED; 

new arg1[32], arg2[10], amount; 
read_argv(1, arg1, sizeof(arg1) - 1); 
read_argv(2, arg2, sizeof(arg2) - 1); 

amount = str_to_num(arg2); 
new target = cmd_target(0, arg1, 2); 

if ( target == 0 ) 
{ 
//couldnt find them 
zp_colored_print(id, "^x04[%s]^x01 Nu am putut gasi Jucatorul Solicitat.", plugin); 

return PLUGIN_HANDLED; 

} else { 
setAmmoPacks(target, getAmmoPacks(target) + amount); 

if(id == target) 
{ 
zp_colored_print(id, "^x04[%s]^x01 V-ati dat singur %d de Credite!", plugin, amount ); 
} else { 
new targetName[64]; 
new szNume[32];
get_user_name(target, targetName, 63); 
get_user_name(id, szNume, charsmax(szNume));  

zp_colored_print(id, "^x04[%s]^x01 Adminul %s i-a Adaugat lui %s o Suma de %d de Credite!", plugin , szNume, targetName, amount ); 
zp_colored_print(target, "^x04[%s]^x01 Adminul %s ti-a oferit suma de %d de Credite!", plugin , szNume, amount ); 
log_to_file( "addons/amxmodx/logs/credite_nivel/credite_zp_banca.log", "[ZP BANK] Adminul %s a dat lui %s o suma de %d de Credite.", szNume, targetName, amount); 
} 
return PLUGIN_HANDLED; 
} 
return PLUGIN_HANDLED; 
} 

/*================================================================================ 
--The following are copied directly from zombie_plague, no reinventing wheels... 
[Shared Functions] 
=================================================================================*/ 
zp_colored_print(target, const message[], any:...) 
{ 
static buffer[512], i, argscount 
argscount = numargs() 

// Send to everyone 
if (!target) 
{ 
static player 
for (player = 1; player <= g_maxplayers; player++) 
{ 
// Not connected 
if (!is_user_connected(player)) 
continue; 

// Remember changed arguments 
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies 
changedcount = 0 

// Replace LANG_PLAYER with player id 
for (i = 2; i < argscount; i++) 
{ 
if (getarg(i) == LANG_PLAYER) 
{ 
setarg(i, 0, player) 
changed[changedcount] = i 
changedcount++ 
} 
} 

// Format message for player 
vformat(buffer, sizeof buffer - 1, message, 3) 

// Send it 
message_begin(MSG_ONE, g_msgSayText, _, player) 
write_byte(player) 
write_string(buffer) 
message_end() 

// Replace back player id's with LANG_PLAYER 
for (i = 0; i < changedcount; i++) 
setarg(changed, 0, LANG_PLAYER) 
} 
} 

// Send to specific target 
else 
{ 
/* 
// Replace LANG_PLAYER with player id 
for (i = 2; i < argscount; i++) 
{ 
if (getarg(i) == LANG_PLAYER) 
setarg(i, 0, target) 
} 
*/ 

// Format message for player 
vformat(buffer, sizeof buffer - 1, message, 3) 

// Send it 
message_begin(MSG_ONE, g_msgSayText, _, target) 
write_byte(target) 
write_string(buffer) 
message_end() 
} 
}

Re: cerere plugin banca

Posted: 07 Jan 2019, 23:43
by Zppp.Mihai94
primesc erorile astea 2 la compilare

zp_bank_dat_credite.sma(142) : error 017: undefined symbol "g_maxplayers"
zp_bank_dat_credite.sma(167) : error 017: undefined symbol "g_msgSayText"
zp_bank_dat_credite.sma(167) : error 029: invalid expression, assumed zero
zp_bank_dat_credite.sma(167) : error 029: invalid expression, assumed zero
zp_bank_dat_credite.sma(167) : fatal error 107: too many error messages on one line

Compilation aborted.
5 Errors.
Done.

rezolvat mersi, era lipsa aceste 2 linii
new g_maxplayers // max players counter
new g_msgSayText // Message IDs vars