[Tutorial] How to make a very simple Anti-Spawn Kill
#1

Okay, so I'm really bored right now sooo, I've decided
to make this very simple tutorial about Anti-Spawn Killing.
My version of Anti-Spawn Killing.

Basically its only 9 Lines.

Okay, lets get started.

-------------------------------------------------------------------


First :
We need to put it on the OnPlayerDeath callback.
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
   return 1;
}
Second :
We will use the IsPlayerInRangeOfPoint, but, instead of playerid, we will use Killerid.
Then find the Spawn coordinates of each teams.
pawn Code:
IsPlayerInRangeOfPoint(killerid, Float:size, Float:SpawnX, Float:SpawnY, Float:SpawnZ);
Third :
Then, we will now merge it in the OnPlayerDeath callback.
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(IsPlayerInRangeOfPoint(killerid, Float:Range, Float:SpawnX, Float:SpawnY, Float:SpawnZ))
   {
    // do whatever punishment you want to do with the Spawn Killer here.
   }
   return 1;
}
-------------------------------------------------------------------

Example :
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(IsPlayerInRangeOfPoint(killerid, 20, 1587, -1693, 7)) // It means that if the player is within 20 meter range some around the Garage of LSPD the following will happen :
   {
    SetPlayerHealth(killerid, 0); // my punishment for the Spawn Killer is Death.
    SendClientMessage(killerid, Red, "SERVER : You can't spawn kill!"); // then sends him a message that he can't spawn kill
   }
   return 1;
}
Then its done!
Reply
#2

Very nice TUT Viruz, useful for newbies >:]

P easy tho
Reply
#3

Quote:
Originally Posted by Lorenc_
View Post
Very nice TUT Viruz, useful for newbies >:]

P easy tho
Thanks =) A lot of ppl are asking me lately about
Anti-Spawn Killing so I've made a simple tut about it =)
Reply
#4

im no newbie but ima use this, antispawn kill = anti noob kill
Reply
#5

Very Good mate that's Easy and Perfect
Reply
#6

I wouldn't call this anti spawn-killing, you're just checking if the killer is near the spawn.

Easy abused by staying in your spawn.

Also, I'm guessing that you accidentily used 'killerid' instead of 'playerid'. Playerid died, so it's better to check if he's near the spawn.
Reply
#7

Nice, and easy to make.
Reply
#8

Nice tutorial!
Simple, and helpful.
Reply
#9

Nice but still the player will get killed -.-
you can use the following but it's not tested I am a newbie at scripting
but check this :
Code:
public OnPlayerSpawn(playerid)
{
	new Float:X, Float:Y, Float:Z;
             GetPlayerPos(playerid, X, Y, Z);   
             if(IsPlayerInRangeOfPoint(playerid,7.0, X, Y, Z)) {
             SetPlayerHealth(playerid,1000);
             }
            else { SetPlayerHealth(playerid,100); }

	return 1;
}
I know it might not work but still a try from a newbie <.<
Reply
#10

More simply is

pawn Code:
SetTimerEx("AntiSpawnkill", [seconds]*1000, false, "d", playerid);
SetPlayerHealth(playerid, 5000);
pawn Code:
forward AntiSpawnkill(playerid);
public AntiSpawnkill(playerid)
{
   SetPlayerHealth(playerid, 100);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)