SA-MP Forums Archive
simple antispawn help - 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: simple antispawn help (/showthread.php?tid=609008)



simple antispawn help - 1fret - 07.06.2016

im not sure if i did this right but here is my issue. Im making an headshot system which works great but only one problem it kills the player still is the are still in anti-spawn protection mode. So i tried to if the player is in antispawn mode here is my checking code:

pawn Код:
OnPlayerSpawn
    antispawn[playerid] = 1;// now i created this so when the player spawns it is set to 1 so that means they are still in antispawn mode.

SetTimerEx("AntiSpawnkill",10000,0,"i",playerid);// then i run the timer which will set there health and armour back to normal after 10 seconds and turn off the antispawn mode (meaning restore antispawn back to 0).

public AntiSpawnkill(playerid)

SendClientMessage(playerid, red, "{F81414}Andre[BOT]: {FFFFFF}Anti-Spawnkill protection over, you are on your own now");
    antispawn[playerid] = 0;// restore the antispawn mode to 0
now here is the code i have for my headshot
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(antispawn[playerid] == 1)// this is what i use to check if the player antispawn mode in on or off
    {
        GameTextForPlayer(issuerid, "Anti-Spawn Protected Player", 5000, 1);
    }



Re: simple antispawn help - oMa37 - 07.06.2016

Try returning 0

PHP код:
if(antispawn[playerid] == 1)// this is what i use to check if the player antispawn mode in on or off
    
{
         
GameTextForPlayer(issuerid"Anti-Spawn Protected Player"50001);
                return 
0;
     }