Check if player is close to checkpoint, then show it - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check if player is close to checkpoint, then show it (
/showthread.php?tid=66082)
Check if player is close to checkpoint, then show it -
Robbin237 - 19.02.2009
Hi guys, ive made a checkpoint with SetPlayerCheckpoint. BUT, what i want, is that it only shows if the player is close to it. How can i do so? Like if hes close, THEN it will set the checkpoint (show it actually)
OR
How do i make the checkpoint invisible on the radar? (Not a red triangle/square marker or anything)
Thanks!
Re: Check if player is close to checkpoint, then show it -
joco96 - 19.02.2009
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;
}
Re: Check if player is close to checkpoint, then show it -
Robbin237 - 19.02.2009
Is there also a way to hide it from the radar?
Re: Check if player is close to checkpoint, then show it -
joco96 - 19.02.2009
I think there is no way to do that... just checking positions.
Re: Check if player is close to checkpoint, then show it -
Robbin237 - 19.02.2009
But i mean remove the red thingy from the radar?
Re: Check if player is close to checkpoint, then show it -
trc_ - 19.02.2009
You can't show or hide a checkpoint and its radar icon separately in SA-MP.