[Tutorial] How to make Anti-SpawnKill
#1

In this i learn to you that how to make Anti-SpawnKill
Let's Get Started
First add include a_samp because it have many things that is important for our tutorial
PHP код:
#include a_samp 
Than see public OnPlayerSpawn(playerid) because SpawnKill means killing when spawn so, we need to do on spawn
PHP код:
public OnPlayerSpawn(playerid
And then add this
PHP код:
    SetPlayerHealth(playerid999999); 
Why this because when player spawn they have 100 health as default so, setting their health to 999999 is good idea so spawn killers can't kill him and we do more steps to setting their health to 100 after 10 seconds
PHP код:
    SetTimerEx("EndAntiSpawnKill"10000true"i"playerid); 
Why this because this is a function of time in which things came into movement after the seconds i type now what is EndAntiSpawnkill, This is the name of a thing which can be used in public because how computer know what happen You can change this name.now 10000, it's milliseconds of the time after the process attempt this is time of when 10000 milliseconds gone after spawn you can change this.now true, it means it's start really if we change to false it means timer can't start.now i, it means intergel number because 10000 is in intergel You can change this if you haven't intergel milliseconds.now playerid, the playerid which spawn and get this if we do only one number so, it's only for him not for all
Now make a forward for public i already said you of public because without forward we can't change a function into public if it is not in an include if you typed any other thing at EndAntiSpawnKill use that you typed not which i typed
PHP код:
forward EndAntiSpawnKill(playerid
Now we created a forward for a public function now we can use that on public
PHP код:
public EndAntiSpawnKill(playerid
Now we Created a public and now let's do what happen.We need to add this and any other thing you want
PHP код:
    SetPlayerHealth(playerid100);
    return 
1;

Why this? Because with this player health will replace to 100 and i typed SetPlayerHealth(playerid, 999999); it means player health setted to 999999 and if we don't replace his health to 100.The player will kill the opponets and others cant kill him.

SORRY FOR MY BAD ENGLISH

THE END
Reply
#2

pawn Код:
SetTimerEx("EndAntiSpawnKill", 10000, true, "i", playerid);  //u realize that this is set to true which means the timer never ends

//should be
SetTimerEx("EndAntiSpawnKill", 10000, false, "i", playerid);
Reply
#3

Good Job
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)