PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <ColorChat>
new Trie:used_command
public plugin_init()
{
register_plugin("AmmoPacks Per Map", "1.1", "Hades ~~~`");
register_clcmd("say /rtd", "ApCommand");
register_clcmd("say rtd", "ApCommand");
register_clcmd("say /free", "ApCommand");
register_clcmd("say /get", "ApCommand");
used_command = TrieCreate()
}
public ApCommand(id)
{
new szAuthid[35]
get_user_authid(id , szAuthid , charsmax(szAuthid)) // szAuthid now contains user authid
if( TrieKeyExists( used_command, szAuthid ) ) // if we have szAuthid in trie
{
ColorChat(id,NORMAL, "You already^3 used^1 this command^4 Try^3 NextMap^1.");
}
else
{
new Random = random_num(1,4)
switch(Random)
{
case 0:
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 20);
ColorChat(id,NORMAL, "You have got^3 20^1 ammopacks for^3 using^1 a legit client.");
}
case 1:
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 30);
ColorChat(id,NORMAL, "You have got^3 30^1 ammopacks for^3 using^1 a legit client.");
}
case 2:
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 40);
ColorChat(id,NORMAL, "You have got^3 40^1 ammopacks for^3 using^1 a legit client.");
}
case 3:
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
ColorChat(id,NORMAL, "You have got^3 50^1 ammopacks for^3 using^1 a legit client.");
}
}
}
TrieSetCell( used_command, szAuthid, 1 ) // save user authid in tire
}
public plugin_end( )
{
TrieDestroy( used_command )
}
rtd,free,get system random ammopacks between 20-50. you can edit.
Thanks to @LearninG for saving each player using command.