checkin coords - 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: checkin coords (
/showthread.php?tid=67774)
checkin coords -
CJ101 - 04.03.2009
-1567.9929,-2729.8674,48.7435,278.3784
how would i write:
if playercoords is those coords, give 5 free score points.
Re: checkin coords -
Sandra18[NL] - 04.03.2009
well, it's almost imposible to be on
exact those coords, so you better use the PlayerToPoint-function.
Код:
SetTimer("CheckPos", 100, 1);
Код:
forward CheckPos();
public CheckPos()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(0.1, i, -1567.9929,-2729.8674,48.7435)
{
SetPlayerScore(i, (GetPlayerScore(i)+5));
}
}
}
Код:
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Float:oldpos[3], Float:temppos[3];
GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
temppos[0] = (oldpos[0] -X);
temppos[1] = (oldpos[1] -Y);
temppos[2] = (oldpos[2] -Z);
if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
{
return true;
}
return false;
}