rendered paste bodynew checkPoints = 1;
new Float:checkCoords[][4] = {
{-36.5483,-57.9948, -17.2655,-49.2967}, //BANK
{1894.6128,1445.3431, 2084.9739,1637.8186}
};
new Float:checkpoints[][3] = {
{-22.2549,-55.6575,1003.5469},
{2000.3132,1538.6012,13.5859}
};
if(strcmp(cmd, "/check", true) == 0) {
new Float:x,Float:y,Float:z;
new Float:xMAX,Float:xMIN,Float:yMAX,Float:yMIN;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerConnected(playerid)){
xMAX = (x + 30.0);
xMIN = (x - 30.0);
yMAX = (y + 30.0);
yMIN = (y - 30.0);
checkPoints++;
{
checkpoints[checkPoints][0] = x;
checkpoints[checkPoints][1] = y;
checkpoints[checkPoints][2] = z;
checkCoords[checkPoints][0] = xMAX;
checkCoords[checkPoints][1] = xMIN;
checkCoords[checkPoints][2] = yMAX;
checkCoords[checkPoints][3] = yMIN;
SendClientMessage(playerid,COLOR_WHITE,"NEw CHeckPOint");
return 1;
}
}
}
public isPlayerInArea(playerID, Float:data[4])
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerID, X, Y, Z);
if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
return 1;
}
return 0;
}
public checkpointUpdate()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) {
for(new j=0; j < checkPoints; j++) {
if(isPlayerInArea(i, checkCoords[j])) {
if(playerCheckpoint[i]!=j) {
DisablePlayerCheckpoint(i);
SetPlayerCheckpoint(i, checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],2);
playerCheckpoint[i] = j;
}
} else {
if(playerCheckpoint[i]==j) {
DisablePlayerCheckpoint(i);
playerCheckpoint[i] = 999;
}
}
}
}
}
}