27.10.2015, 12:11
Take my code.
IsPlayerInArea is the function to check if the players are in the area of the spawn.
Try this.
PHP код:
public OnPlayerDeath(playerid,killerid,reason)
{
if(killerid != INVALID_PLAYER_ID)
{
if(IsPlayerInArea(playerid,XX,XX,XX,XX))
{
SetPlayerHealth(killerid,0.0);
}
}
return 1;
}
/* Notes:
- The XX,XX,XX,XX are the coordinates
(1. XX => MinX)
(2. XX => MinY)
(3. XX => MaxX)
(4. XX => MaxY)
- Use this function at the end of this codes
*/
//This is the function which you need:
IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
return 1;
}
return 0;
}
Try this.
