05.03.2017, 12:37
I'm trying to create a script where once the player enters the checkpoint, he'll be able to roam freely and capture turf under certain coordinates(gangzone turf).
But the capture just fails instantly when the player enters, any idea?
But the capture just fails instantly when the player enters, any idea?
Код:
public OnPlayerEnterCheckpoint(playerid)
{
SendClientMessage(playerid, 0x00FF007A, "Please wait sixty seconds to capture this zone again."); // Telling the player to wait 30 seconds.
GangZoneFlashForAll(TURF1, 0xFF80FF76); // Makes the turf Flash Pink ( telling everyone its being taken over )
SendClientMessageToAll(0xFF80FFFF, "This zone is currently being taken over! Find the capturer and kill him!"); // Sending Message to all players.
timer = SetTimerEx("SetZone", 60000, false, "i", playerid); // Setting the Timer... ( 30 seconds )
Checkpoint[playerid] = 1; // Telling the variable that the player is in the checkpoint.
return 1;
}
Код:
public OnPlayerUpdate(playerid)
{
if(Checkpoint[playerid] == 1)
IsPlayerInArea(playerid, 1946.4427, 1908.5669, -1761.9777, -1792.7344);
return 1;
}
forward IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);
public IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, 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;
}
else
{
SendClientMessage(playerid, 0x00FF007A, "You've left the checkpoint, you failed to capture the turf!");
GangZoneStopFlashForAll(TURF1);
SendClientMessageToAll(0x00FF007A, "ZONE was not taken over.");
KillTimer(timer);
Checkpoint[playerid] = 0;
}
return 1;
}


