Hi i have problem in this code of gunxp supply boxes
it spawn in the map and player get it and player it get it and get random xp from 1-500
and it write
[GunXP] you found 200 XP
and some times its write
[GunXP] you found 120 XP
[GunXP] you found 54XP
in same box whitch player found so what i mean
i mean when player found it , some times (not always give 2 casses) its give him 2 casses in same time so i wanna fix it and get always give 1 case mean [GunXP] you found ...XP not troubling in it and thanx .
PHP Code:
public round_end()
{
if(!total_presents) return
remove_all_presents()
}
public round_start()
{
if(!total_presents) return
remove_task(1337)
set_task(get_pcvar_float(spawn_time), "spawn_random_presents", 1337, _, _, "b")
}
public spawn_random_presents()
{
new num = random_num(get_pcvar_num(min_presents),get_pcvar_num(max_presents))
if(num != 0) for(new ii=0;ii<num;ii++) spawn_present(present_data[random(total_presents)])
}
public present_touch(ent,id)
{
give_random_present(ent, id);
return 0;
}
public give_random_present(ent,id)
{
new xp = 0;
xp = random_num(1, 500);
set_user_xp(id, get_user_xp(id) + xp);
ColorChat(id,GREEN,"^x04[^x03GunXP^x04]^x01 You Found^x04 %i^x01 XP!", xp);
emit_sound(ent,CHAN_AUTO,"supplyboxes/presents_get.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
remove_entity(ent)
}
__________________