SA-MP Forums Archive
if(PlayerToPoint error - 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: if(PlayerToPoint error (/showthread.php?tid=154326)



if(PlayerToPoint error - Ihsan_Cingisiz - 13.06.2010

Hello, i made in OnPlayerUpdate() a script for that it will
display a GameText message but i get this error :
Quote:

error 017: undefined symbol "PlayerToPoint"

I use this script :
Quote:

public OnPlayerUpdate(playerid)
{
if(PlayerToPoint(3.0,playerid,1635.4154,-2334.1201,13.5469)) {
GameTextForPlayer(playerid, "~w~Los Santos Airport~n~Type /guide to get your guide", 2500, 3);
}
return 1;
}




Re: if(PlayerToPoint error - Dark_Kostas - 13.06.2010

You can use [ pawn] tags to post samp code. Also you can use IsPlayerInRangeOfPoint instead. Also OnPlayerUpdate is called many times per sec! It would be better to create a timer being called every sec and put it here.


Re: if(PlayerToPoint error - bestr32 - 05.03.2011

Here is how.. Do this:
forward PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z);
somewhere at the top of the script under the includes
Than
Scroll Down, or anywhere and do this:

public PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
new Floatldposx, Floatldposy, Floatldposz;
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;
}

And now try


public OnPlayerUpdate(playerid)
{
if(PlayerToPoint(3.0,playerid,1635.4154,-2334.1201,13.5469)) {
GameTextForPlayer(playerid, "~w~Los Santos Airport~n~Type /guide to get your guide", 2500, 3);
}
return 1;
}


Re: if(PlayerToPoint error - bestr32 - 05.03.2011

Put this at the top\bottom anywhere of the script
PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
new Floatldposx, Floatldposy, Floatldposz;
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;
}

or the following:

#include <a_samp>

and

#if defined FILTERSCRIPT

forward PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z);

paste this there.

Now.

After that. Paste this down somewhere else. Paste it at the bottom just to be sure you don't paste it under something.

public PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
new Floatldposx, Floatldposy, Floatldposz;
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;
}

And try
that script u use now.


public OnPlayerUpdate(playerid)
{
if(PlayerToPoint(3.0,playerid,1635.4154,-2334.1201,13.5469)) {
GameTextForPlayer(playerid, "~w~Los Santos Airport~n~Type /guide to get your guide", 2500, 3);
}
return 1;
}

Try if this works


Re: if(PlayerToPoint error - bestr32 - 05.03.2011

Sorry I replyed 2 times, but the second way is the better, because the first doesn't even tell where. something like that


Re: if(PlayerToPoint error - Ironboy - 05.03.2011

it is not clear use [pawn]


Re: if(PlayerToPoint error - bestr32 - 05.03.2011

Oh ok.


Re: if(PlayerToPoint error - Mean - 05.03.2011

Add this somewhere:
pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
    new Floatldposx, Floatldposy, Floatldposz;
    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;
}