Hi everyone, well I'm doing something like a mini game of usp (pistol) that tries that when the round begins it gives everyone a usp with only one bullet ready to fire, every 5 seconds it gives a bullet, my question is how can I to detect if the player still has the bullet? What I want to do is that if the player still has the bullet, he will not get another bullet, so he will not accumulate bullets, but until he has no bullets and so on.
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#define PLUGIN "Battle Usp"
#define VERSION "1.0"
#define AUTHOR "khe"
new g_MaxPlayers
#define TASK_BULLET 655
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
g_MaxPlayers = get_maxplayers()
}
public NewRound()
{
for (new id = 1; id <= g_MaxPlayers; id++)
{
if (!is_user_alive(id))
continue
show_menu(id, 0, "^n", 1)
strip_user_weapons(id)
cs_set_weapon_ammo(give_item(id, "weapon_usp"), 1)
set_task(5.0, "Task_GiveBullet", id+TASK_BULLET, _, _, "b")
}
}
public Task_GiveBullet(id)
{
id -= TASK_BULLET
cs_set_weapon_ammo(give_item(id, "weapon_usp"), 1)
}