Posiadam plugin, który dodaje 150 HP na start. Chcę jednak, by plugin dodawał te 150 HP tylko graczom z flagą "x", a nie wszystkim. Jak widać, zdefiniowałem już na początku flagę "x", jednak gdziekolwiek bym nie wstawił "if (get_user_flags(id) & ADMIN_FLAG_X)" sprawdzającego flagę, pojawia się błąd: "Error: Undefined symbol "id" on line ..."
Czy może ktoś wstawić tę instrukcję warunkową tak, by plugin dawał 150 HP tylko graczom z flagą "x" ?
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#define PLUGIN "HP na start"
#define VERSION "1.0"
#define AUTHOR "Leszek!"
#define ADMIN_FLAG_X (1<<23)
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
register_event("TeamInfo","new_player","a","2=CT","2=TERRORIST")
register_cvar("amx_starthp","150")
if(get_cvar_num("amx_starthp") > 250)
set_cvar_num("amx_starthp",250)
}
public new_player()
{
new id = read_data(1)
if(is_user_connected(id) && is_user_alive(id))
set_user_health(id,get_cvar_num("amx_starthp"))
}
public NewRound()
set_task(0.1,"set_health")
public set_health()
for(new i = 0; i <= get_playersnum(); ++i)
if(is_user_connected(i) && is_user_alive(i))
set_user_health(i,get_cvar_num("amx_starthp"))
Użytkownik maaciek_ edytował ten post 22.09.2011 12:31