Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
Cerere plugin unlimited ammo
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Resources
Author
Message
1157
Speeder890
[Mentally Stable]
Status: Offline
(since 17-06-2013 12:23)
Joined: 22 May 2013
Posts: 18
,
Topics: 8
Location:
Romania
Reputation:
35.4
Votes
: 2
Posted: 27-05-2013, 13:51:28
| Translate post to:
... (
Click for more languages
)
Salut , stie cineva un plugin care sa salveze toate ammo pe care le are un player ? am incercat cu zp_bank dar salveaza maxim 1k si vreau unu care sa salveze ammo nelimitate .
Multumesc .
0
0
Back to top
Happy =]]
[I'm in your mind !]
Status: Offline
(since 02-05-2020 11:17)
Joined: 17 Mar 2012
Posts: 10538
,
Topics: 450
Location:
In mintea ta !
Reputation:
553
Votes
: 204
Posted: 27-05-2013, 14:51:36
| Translate post to:
... (
Click for more languages
)
Poti incerca
asta
.
Sau poti modifica aici :
Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fakemeta>
#include <colorchat>
#include <zombieplague>
static const version[] = "0.3";
static const plugin[] = "[ZP] Sub Plugin: Auto-save Bank(Name)";
static const prefix[] = "ZP Bank"
enum pcvar
{
enable = 0,
cap,
start
}
new pcvars[pcvar];
new bankstorage[33];
new gvault, thinkobj;
public plugin_init()
{
register_plugin(plugin, version, "Random1, 93()|29!/<");
gvault = nvault_open("Zombie Bank Name");
pcvars[enable] = register_cvar("zp_bank", "1");
pcvars[cap] = register_cvar("zp_bank_limit", "5000");
pcvars[start] = register_cvar("zp_bank_blockstart", "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");
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;
ColorChat(0, GREEN, "[%s]^x01 Лимит банка^x03 %d^x01 Медалей", prefix, get_pcvar_num(pcvars[cap]));
ColorChat(0, GREEN, "[%s]^x01 Вклад медалей в банк^x03 deposit <amount>", prefix);
ColorChat(0, GREEN, "[%s]^x01 Снятие медалей^x03 withdraw <amount>", prefix);
ColorChat(0, GREEN, "[%s]^x01 Банк сохраняет медали^x03 автоматически", prefix);
set_pev(ent, pev_nextthink, get_gametime() + 240.0);
return FMRES_HANDLED;
}
public plugin_end()
nvault_close(gvault);
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);
//dbg_log("cmd_say() arg1:#%s# arg2:#%s# arg3:#%s#", arg1, arg2, arg3);
// 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))
{
if (isdigit(arg2[0]) || (arg2[0] == '-' && isdigit(arg2[1])))
{
new value = str_to_num(arg2);
store_cash(id, value);
ColorChat(id, GREEN, "[%s]^x01 Вы положили^x03 %d^x01 медалей в банк", prefix, value)
return PLUGIN_HANDLED;
}
else if (equali(arg2, "all"))
{
store_cash(id, -1);
ColorChat(id, GREEN, "[%s]^x01 Вы вклали в банк^x03 все^x01 медали", prefix)
return PLUGIN_HANDLED;
}
else if (arg2[0] == 0)
ColorChat(id, GREEN, "[%s]^x01 Вклад медалей в банк^x03 deposit <amount to deposit>", prefix);
return PLUGIN_CONTINUE;
}
else if (equali(arg1, "withdraw", 8) || equali(arg1, "take", 4) || equali(arg1, "retrieve", 8))
{
if (isdigit(arg2[0]) || (arg2[0] == '-' && isdigit(arg2[1])))
{
new value = str_to_num(arg2);
take_cash(id, value);
ColorChat(id, GREEN, "[%s]^x01 Вы сняли с банка^x03 %d^x01 медалей", prefix, value)
return PLUGIN_HANDLED;
}
else if (equali(arg2, "all"))
{
take_cash(id, -1);
ColorChat(id, GREEN, "[%s]^x01 Вы сняли с банка^x03 все^x01 медали", prefix)
return PLUGIN_HANDLED;
}
else if (arg2[0] == 0)
ColorChat(id, GREEN, "[%s]^x01 Снятие медалей^x03 withdraw <amount to withdraw>", prefix);
return PLUGIN_CONTINUE;
}
else if (equali(arg1, "mybank", 6) || equali(arg1, "account", 7) || equali(arg1, "bank", 4))
{
if (arg2[0] == 0)
{
ColorChat(id, GREEN, "[%s]^x01 В вашем банке^x03 %d^x01 медалей", prefix, bankstorage[id]);
return PLUGIN_HANDLED;
}
else
{
new player = cmd_target(id, arg2, 2);
if (!player)
return PLUGIN_CONTINUE;
static playername[32];
get_user_name(player, playername, 31);
ColorChat(id, GREEN, "[%s]^x03 %s^x01 имеет^x04 %d^x01 Медалей", prefix, playername, bankstorage[player]);
return PLUGIN_HANDLED;
}
}
}
else if (equali(arg1, "donate", 6))
{
give_cmd(id, arg2, arg3);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
give_cmd(id, target[], amnt[])
{
new temp = str_to_num(amnt);
if (temp < 0)
{
ColorChat(id, GREEN, "[%s]^x01 - ^"amount^" переполнен банк", prefix);
return;
}
new player = cmd_target(id, target, 8);
if (!player)
return;
new temp2 = bankstorage[id] + zp_get_user_ammo_packs(id);
if (temp > temp2)
{
ColorChat(id, GREEN, "[%s]^x01 Вам нехвотает медалей, увас только^x04 %d^x01 из of^x03 %d^x01 specified", prefix, temp2, temp);
return;
}
static playername[32], givename[32];
get_user_name(player, playername, 31);
get_user_name(id, givename, 31);
ColorChat(id, GREEN, "[%s]^x01 подарил^x03 %d^x01 медалей^x04 %s", prefix, temp, playername);
ColorChat(player, GREEN, "[%s]^x03 %s^x01 подарил^x04 %d^x01 медалей вам", prefix, givename, temp);
bankstorage[player] += temp;
if (bankstorage[id] > temp)
bankstorage[id] -= temp;
else
{
temp -= bankstorage[id];
bankstorage[id] = 0;
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - temp);
}
}
//public zp_user_disconnect_pre(id)
public client_disconnect(id)
{
store_cash(id, -1);
if (bankstorage[id] > 0)
save_data(id);
}
//public zp_user_connect_post(id)
public client_connect(id)
{
bankstorage[id] = 0; //clear residual before loading
retrieve_data(id);
}
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);
ColorChat(id, GREEN, "[%s]^x01 Ваш банк достиг максимума^x03 %d", prefix, limit);
ColorChat(id, GREEN, "[%s]^x01 Только^x03 %d^x01 из^x04 %d^x01 были положены в банк", prefix, amnt - overflow, amnt);
}
}
else
ColorChat(id, GREEN, "[%s]^x01 Вы хотите снять(^x03%d^x01) Медалей, увас только(^x04%d^x01)", prefix, amnt, temp);
}
else
take_cash(id, -amnt);
}
take_cash(id, amnt)
{
if (!get_pcvar_num(pcvars[enable]))
return;
if (amnt == 0) //otherwise a non terminal loop is possible
return;
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 {
ColorChat(id, GREEN, "[%s]^x01 Сумма (^x03%d^x01) больше чем в банке(^x04%d^x01)", prefix, amnt, bankstorage[id]);
}
}
else store_cash(id, -amnt);
}
save_data(id)
{
new Name[35];
get_user_name(id, Name, 34);
new vaultkey[40], vaultdata[13];
formatex(vaultkey, 39, "__%s__", Name);
formatex(vaultdata, 12, "%i", bankstorage[id]);
nvault_set(gvault, vaultkey, vaultdata);
}
retrieve_data(id)
{
new Name[35];
get_user_name(id, Name, 34);
new vaultkey[40], vaultdata[13];
format(vaultkey, 39, "__%s__", Name);
nvault_get(gvault, vaultkey, vaultdata, 12);
bankstorage[id] = str_to_num(vaultdata);
checkmax(id);
// If they have an account don't allow zombie mod to give them 5 ammo packs at beggining
if (get_pcvar_num(pcvars[start]) && bankstorage[id] > 0)
zp_set_user_ammo_packs(id, 0);
}
checkmax(id)
{
if (bankstorage[id] > get_pcvar_num(pcvars[cap]))
bankstorage[id] = get_pcvar_num(pcvars[cap]);
else if (bankstorage[id] < 0)
bankstorage[id] = 0;
}
Pentru orice problema PM.
Nu ofer asistenta in privat.
0
0
Back to top
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Resources
The time now is 03-12-2024, 01:19:26
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details