18.05.2013, 17:17
Okay, so I'm getting bored ATM so, I've decided to make this very simple tutorial about 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 :
Suggestions of all types are open.
Please help me improve if anything is wrong in the tutorial!
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;
}
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;
}
Please help me improve if anything is wrong in the tutorial!