respawn mod?
i all im trying to make a simple respawn the thing is that sometimes when the player respawn the crossair gone with the hp, shield and round timer.
you just can't see it?
this is my code maybe u will say that's a ugly code etc etc but well i do my best if you could fix it or post a more simple code that do what im trying be welcome
PHP Code:
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) //RegisterHam( Ham_Killed , "player", "HAM_Killed" ) //gmsgStatusIcon = get_user_msgid("StatusIcon"); g_pEnabled = register_cvar("dm_enabled","0") g_pProtection = register_cvar("dm_protection","1") g_pProtectionTime = register_cvar("dm_protection_time","3") g_msgid_ClCorpse = get_user_msgid("ClCorpse") register_event( "TeamInfo", "join_team", "a"); register_event("DeathMsg", "death_mes", "a"); register_event("StatusIcon","GotBomb","be","1=1","1=2","2=c4"); }
public client_connect(id) { g_connected[id] = false }
public spawnagain(id) { //Make sure he didn't disconnect in the 0.5 seconds that have passed. if(is_user_connected(id)) { //Spawn player spawn(id) set_msg_block(g_msgid_ClCorpse, BLOCK_ONCE) if ( get_pcvar_num( g_pProtection ) == 1 ) { set_user_godmode(id,1) new Float:protect = get_pcvar_float( g_pProtectionTime ) set_task(protect,"stopprotect",id) set_task(1.1,"giveweapon",id) }
//After 1.0 the player will be spawned fully and you can mess with the ent (give weapons etc) //set_task(1.0,"player_fully_spawned",id) } }
public giveweapon(id) { if ( get_user_team( id ) == 1 ) { give_item(id,"weapon_knife") give_item(id,"weapon_glock18") give_item(id,"ammo_9mm") give_item(id,"ammo_9mm") cs_set_user_money(id,16000) } else { give_item(id,"weapon_knife") give_item(id,"weapon_usp") give_item(id,"ammo_45acp") give_item(id,"ammo_45acp") cs_set_user_money(id,16000) } }
public stopprotect(id) { if(is_user_alive(id)) set_user_godmode(id) }
public check_alive(id) { if(!get_pcvar_num(g_pEnabled) || !is_user_connected(id) || is_user_alive(id)){ return; } else { if(!is_user_alive(id)) { set_task(1.0,"spawnagain",id) } } }
public death_mes() { new victim = read_data(2); if(get_pcvar_num(g_pEnabled)) { set_task(1.0,"check_alive",victim) } return PLUGIN_HANDLED; }
public join_team() { new id = read_data(1) static user_team[32]
read_data(2, user_team, 31) if(!is_user_connected(id)) return PLUGIN_CONTINUE switch(user_team[0]) { case 'C': { if(g_connected[id] == false && get_pcvar_num(g_pEnabled)){ set_task(6.0,"check_alive",id) g_connected[id] = true } } case 'T': { if(g_connected[id] == false && get_pcvar_num(g_pEnabled)){ set_task(6.0,"check_alive",id) g_connected[id] = true } } } return PLUGIN_CONTINUE }
|