19.02.2009, 10:53
pawn Код:
public OnFilterScriptInit() {
SetTimer("CheckPlayers", 1000, true);
}
forward CheckPlayers();
public CheckPlayers() {
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(PlayerToPoint(10, cehckpointX, cehckpointY, cehckpointZ) {
SendClientMessage(playerid, 0xFFFF00AA, "Get into the checkpoint");
}
}
}
}
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}