Re: Take The Glow
Your code have some mistakes.
PHP Code:
public roundstart(){ new ID = random_num(1 , get_maxplayers() - 1) if (get_pcvar_num(g_toggle) == 1) glow(ID, 255, 255, 255) get_user_name(ID, sName, 32) get_user_team(ID, sTeam, 32) glowmsg(sName,sTeam) }
You need to check if are players playing, then, check if the 'ID' is alive, in other case, you need to repeat the process.
- Why use 'isGlowing(index)' instead of 'g_IsGlowing[index]' directly ?
PHP Code:
public HookKilled(victim, killer, shouldgib) { if (isGlowing(victim)){ kID = killer glow(kID, 255,255,255) unglow(victim) get_user_name(kID, sName, 32)//It is a bugfix get_user_team(kID, sTeam, 32) glowmsg(sName,sTeam) } }
You need to check if the 'killer' is alive.
And what happens if the 'killer' throw a grenade, he dies, and when the grenade explodes he kills the player with glow ?
PHP Code:
stock glowmsg(glower_name[], glower_team[]) { for (new i = 1 ; i <= get_maxplayers() ; i++){ client_print(i , print_chat , "[AMXX] %s (%s) is glowing, kill him to take his glow",glower_name,glower_team) } }
If you idea is send a message to all clients, use 0 in the first parameter of client_print.
Quote:
/* Sends message to player. Set index to 0 to send text globaly. */
native client_print(index,type,const message[],any:...);
|
- Use a var like 'g_MaxPlayers' to store 'get_maxplayers();' in 'plugin_init', and then use this var later in the loop of 'roundend' and here: 'new ID = random_num(1 , get_maxplayers() - 1)'
- You need to reset 'g_IsGlowing[index]' when a player is connect or disconnect.
- What happens if the player with glow is disconnect ?
And sorry for my english, I am learning and practicing.
|