Anti-Spawn Kill Message Repeats twice - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti-Spawn Kill Message Repeats twice (
/showthread.php?tid=466541)
Anti-Spawn Kill Message Repeats twice [Solved] - Patrick - 28.09.2013
Problem Solved
Re: Anti-Spawn Kill Message Repeats twice -
DanishHaq - 28.09.2013
Quote:
Originally Posted by pds2012
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
OnPlayerSpawn
pawn Code:
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
pawn 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.
Re: Anti-Spawn Kill Message Repeats twice - Patrick - 28.09.2013
@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
Re: Anti-Spawn Kill Message Repeats twice -
DanishHaq - 28.09.2013
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.
Re: Anti-Spawn Kill Message Repeats twice [Solved] - Patrick - 28.09.2013
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

.