if(PlayerToPoint error
#1

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;
}

Reply
#2

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.
Reply
#3

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;
}
Reply
#4

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
Reply
#5

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

it is not clear use [pawn]
Reply
#7

Oh ok.
Reply
#8

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)