rendered paste bodynew 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},
{0.0,0.0,0.0}
};
//--------------CHECKPOINT ADD TEST--------------------------
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);
xMIN = (x - 30);
yMAX = (y + 30);
yMIN = (y - 30);
checkPoints++;
{
checkpoints[1][0] = x;
checkpoints[1][1] = y;
checkpoints[1][2] = z;
checkCoords[1][0] = xMAX;
checkCoords[1][1] = xMIN;
checkCoords[1][2] = yMAX;
checkCoords[1][3] = yMIN;
SendClientMessage(playerid,COLOR_WHITE,"NEw CHeckPOint");
{
SetTimer("checkpointUpdate",1000,0);
return 1;
}
}
}
}
//CHECKPOINT UPDATE FUNCTIONS
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 < MAX_POINTS; 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;
}
}
}
}
}
}