25.07.2010, 07:11
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.
Second :
We will use the IsPlayerInRangeOfPoint, but, instead of playerid, we will use Killerid.
Then find the Spawn coordinates of each teams.
Third :
Then, we will now merge it in the OnPlayerDeath callback.
-------------------------------------------------------------------
Example :
Then its done!
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;
}
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);
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;
}