heres one that should work (compare the 2)
Code:
#include <amxmodx> //only include things your using
#include <fun>
#define MAX_PLAYERS 32
//we dont need to make id global
new isonapill[33]
public plugin_init()
{
register_plugin("Adrenaline pills","0.0.0.0","Dean Booker AKA Ecko Mantle");
//register it as a console command so we can get the id properly
register_concmd("item_apill","item_apill",ADMIN_ALL)
//register it again for admins that want to set it to everyone
register_concmd("item_apill_all","item_apill_all",ADMIN_KICK)
}
public item_apill_all(id)
{
for(new i=1; i<MAX_PLAYERS; i++) //there is a better way to get players, but im in a hurry
{
if(is_user_connected(i))
item_apill(i)
}
}
public item_apill(id)//we get the id here
{
if(isonapill[id] = 1 || 1>id>MAX_PLAYERS)//stop if it isnt a proper id (a different ent or the server console), note that MAX_PLAYERS is defined at the top
{
return PLUGIN_HANDLED
}
if(is_user_alive(id)) //can only set maxspeed on alive people
set_user_maxspeed(id,450.0)
client_cmd(id, "cl_forwardspeed 450.0")
client_cmd(id, "cl_sidespeed 450.0")
client_cmd(id, "cl_backspeed 450.0")
client_cmd(id, "say /me takes an Adrenaline Pill.")
client_cmd(id, print_chat, "[Umbrella] You take an Adrenaline Pill.")
set_task(30.0, "apill_end", id)//your passing the id
isonapill[id] = 1
return PLUGIN_HANDLED;
}
public apill_end(id)//we passed the id, so lets keep it
{
if(is_user_alive(id)) //again only alive people
set_user_maxspeed(id, 350.0)
client_cmd(id, "cl_forwardspeed 350.0")
client_cmd(id, "cl_sidespeed 350.0")
client_cmd(id, "cl_backspeed 350.0")
isonapill[id] = 0
return PLUGIN_HANDLED
}