View Full Version : Anti-Spawn Kill Message Repeats twice

28/09/2013, 11:50 AM
Problem Solved

28/09/2013, 11:55 AM
Everytime I spawn the message sends twice not once, I've been checking those two codes, and I haven't found the problem, I'm using y_timers


public OnPlayerSpawn(playerid)
IsPlayerSpawn[playerid] = 1;
SetPlayerSkin(playerid, PlayerSkin[playerid]);
SetPlayerPos(playerid, 61.2377, -251.5834, 1.5781);

//Anti Spawn Kill
SetPlayerHealth(playerid, 9999);
SetPlayerArmour(playerid, 9999);

SendClientMessage(playerid, COLOR_WHITE, "["COL_DARKBLUE"ANTI SPAWN KILL"COL_WHITE"] - You're protected for 10 seconds, you have that time to choose your items(/guns & /vehicles)");

SetPlayerChatBubble(playerid, "Anti Spawn Kill (Protected Player)", 0xFF0000AA, 100.0, 10000);

defer AntiSpawnKill(playerid);
return 1;

Timer Code

timer AntiSpawnKill[10000](playerid)
if(IsPlayerSpawn[playerid] == 1)
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE, "["COL_DARKBLUE"ANTI SPAWN KILL"COL_WHITE"] - Anti Spawn Kill Is over, now it's time to kill some players!");
return 1;

This is how it looks like

PS: Noobish question, I know right :), I'm just in a hurry

Under OnPlayerDeath, do you have OnPlayerSpawn(playerid) or SpawnPlayer(playerid)? Because then you're calling it twice.

28/09/2013, 12:02 PM
@DanishHaq No, I don't have SpawnPlayer(playerid) or OnPlayerSpawn(playerid)

But yes, I do use a Function SpawnPlayer, for my KillCamera and to skip the OnPlayerRequestClass

28/09/2013, 12:04 PM
And in any filterscripts? If not, try and use the standard SetTimerEx and see if that works instead of using y_timers or whatever you're using.

28/09/2013, 12:06 PM
DanishHaq I never use Filterscript, if I do have a favorite filterscript I found on forums, I automatically add it on my gamemode, Alright, I'll be testing SetTimerEx

EDIT: Even though I use SetTimerEx, the message executes twice for some reason, I've returned the SpawnPlayer(playerid) so it won't bug, but it is still the same.

2nd Edit: Fixed it, once again sorry for my noobish question :).