SA-MP Forums Archive
[Tutorial] How to make a very simple Anti-Spawn Kill - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make a very simple Anti-Spawn Kill (/showthread.php?tid=162891)



How to make a very simple Anti-Spawn Kill - ViruZZzZ_ChiLLL - 25.07.2010

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!


Re: How to make a very simple Anti-Spawn Kill - Lorenc_ - 25.07.2010

Very nice TUT Viruz, useful for newbies >:]

P easy tho


Re: How to make a very simple Anti-Spawn Kill - ViruZZzZ_ChiLLL - 25.07.2010

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 =)


Re: How to make a very simple Anti-Spawn Kill - willsuckformoney - 25.07.2010

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


Re: How to make a very simple Anti-Spawn Kill - waim - 30.07.2010

Very Good mate that's Easy and Perfect


Re: How to make a very simple Anti-Spawn Kill - Hiddos - 31.07.2010

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.


Re: How to make a very simple Anti-Spawn Kill - iZN - 31.07.2010

Nice, and easy to make.


Re: How to make a very simple Anti-Spawn Kill - [MWR]Blood - 04.08.2010

Nice tutorial!
Simple, and helpful.


Re: How to make a very simple Anti-Spawn Kill - LKJ - 05.08.2010

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 <.<


Re: How to make a very simple Anti-Spawn Kill - Claude - 08.08.2010

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);
}