I wanted to create a Peace-Zone at the Pirate-Ship in Las Venturas, if u want to enter the Zone your weapons'll be reseted, if u kill someone who is at the ship u'll be killed. I have started to work on it. There aren't any Error Messages but In-Game it doesnt work :/
Код:
....
forward IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y);
....
SetTimer("IsPlayerInArea",1000, 1);
....
public OnPlayerDeath(playerid, killerid, reason) //SCORE SYSTEM!
{
....
if(IsPlayerInArea(playerid,1993.837, 1958.693, 1589.296, 1515.803) && playerid != killerid)
{
SendClientMessage(killerid,rot, "Killing is not allowed at the Ship!");
SetPlayerHealth(killerid, -1);
SetPlayerScore(playerid, GetPlayerScore(killerid) - 1);
}
}
....
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
....
for the Kill...and:
SetTimer("isPlayerInArea",1000, 1);
....
forward isPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y);
....
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= -1993.837 && X >= 1958.693 && Y <= 1589.296 && Y >= 1515.803)
{
SetPlayerHealth(i, 999999.9);
ResetPlayerWeapons(i);
}
}
}
....for the ResetWeapons
I'm a beginner and I dont know what is wrong xD, It would be great if anyone can help me