SA-MP Forums Archive
Will this work? - 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: Will this work? (/showthread.php?tid=179892)



Will this work? - Memoryz - 29.09.2010

pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{   // Created by ******

    new Float:a;

    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);

    if (GetPlayerVehicleID(playerid)) {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Will that code work? It doesn't seem to return any value on the code. I havent tested it yet


Re: Will this work? - Norn - 29.09.2010

Would it not be wise to test the code before posting it?


Re: Will this work? - Memoryz - 29.09.2010

I cannot right now because SA-MP is not installed on this computer.


Re: Will this work? - Norn - 29.09.2010

Quote:
Originally Posted by Memoryz
Посмотреть сообщение
I cannot right now because SA-MP is not installed on this computer.
Couldn't you have waited and then posted if it didn't work another time?

Seems strange to me, sorry if I sound off putting.


Re: Will this work? - Grim_ - 29.09.2010

It'll store the values into pre-defined variables, for example:
pawn Код:
new Float:x, Float:y;
GetXYInfrontOfPlayer(playerid, x, y, 5.0);
That will get the X and Y coordinates 5.0 units in front of the player. (Which store in x and y)


Re: Will this work? - Memoryz - 29.09.2010

Quote:
Originally Posted by Norn
Посмотреть сообщение
Couldn't you have waited and then posted if it didn't work another time?

Seems strange to me, sorry if I sound off putting.
You sound completely off putting :P


Quote:
Originally Posted by Grim_
Посмотреть сообщение
It'll store the values into pre-defined variables, for example:
pawn Код:
new Float:x, Float:y;
GetXYInfrontOfPlayer(playerid, x, y, 5.0);
That will get the X and Y coordinates 5.0 units in front of the player. (Which store in x and y)
Thank-you, I have never seen that before, but now I know