SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/09/2013, 11:50 AM   #1
Patrick
Guest
 
Posts: n/a
Default Anti-Spawn Kill Message Repeats twice [Solved]

Problem Solved

Last edited by Patrick; 28/09/2013 at 12:21 PM.
  Reply With Quote
Old 28/09/2013, 11:55 AM   #2
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,351
Reputation: 134
Default Re: Anti-Spawn Kill Message Repeats twice

Quote:
Originally Posted by pds2012 View Post
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.
DanishHaq is offline   Reply With Quote
Old 28/09/2013, 12:02 PM   #3
Patrick
Guest
 
Posts: n/a
Default Re: Anti-Spawn Kill Message Repeats twice

@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
  Reply With Quote
Old 28/09/2013, 12:04 PM   #4
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,351
Reputation: 134
Default Re: Anti-Spawn Kill Message Repeats twice

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.
DanishHaq is offline   Reply With Quote
Old 28/09/2013, 12:06 PM   #5
Patrick
Guest
 
Posts: n/a
Default Re: Anti-Spawn Kill Message Repeats twice [Solved]

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 .
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] Anti Spawn Kill forgottenkings Filterscripts 10 16/10/2013 04:48 PM
[FilterScript] Anti-Spawn Kill [NVC]Eduardo Lançamentos/Releases 22 21/04/2012 08:57 PM
Need Help with Anti Spawn Kill SpiderWalk Help Archive 12 10/06/2011 05:46 PM
Anti Spawn Kill BlackWolf120 Help Archive 1 09/03/2011 12:48 PM


All times are GMT. The time now is 07:33 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.