Playertopoint help - 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: Playertopoint help (
/showthread.php?tid=105736)
Playertopoint help -
Pinehole - 30.10.2009
I have this in my script
Code:
forward PlayerToPoint (Float:radi, playerid, Float:x, Float:y, Float:z);
and this code
Code:
if (strcmp("/claim", cmdtext, true, 10) == 0)
{
if(PlayerToPoint(15.0, playerid, 2516.3457,-1675.3977,13.9453))
SendClientMessageToAll(COLOR_GREEN, "%s has claimed Grove Street Families turf !");
return 1;
}
I dont know why it's giving me errors
Re: Playertopoint help -
Luka P. - 30.10.2009
Yoou don't have PlayerToPoint function.
Add this at end of your script
pawn Code:
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;
}