SA-MP Forums Archive
SetPlayerPos [Rep +1] - 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)
+--- Thread: SetPlayerPos [Rep +1] (/showthread.php?tid=307539)



SetPlayerPos [Rep +1] - ZmaXy - 30.12.2011

I made this

pawn Код:
CMD:port(playerid,params[])
{
    #pragma unused params
    SetPlayerPos(playerid,2048.9729,-1908.4037,13.5469);
    return true;
}
pawn Код:
CMD:portback(playerid,params[])
{
    #pragma unused params
    //How do I return to the coordinates where it was when he type / port
    return true;
}



Re: SetPlayerPos [Rep +1] - -Prodigy- - 30.12.2011

Save the player's position like this:
pawn Код:
new
    Float: gLastPos[MAX_PLAYERS][3];

//When you use the command:

CMD:port(playerid,params[])
{
    #pragma unused params

    GetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]); // Save the coordinates of his position

    SetPlayerPos(playerid,2048.9729,-1908.4037,13.5469);
    return true;
}

// Return him back to his old location:
CMD:portback(playerid,params[])
{
    #pragma unused params
    //How do I return to the coordinates where it was when he type / port
    SetPlayerPos(playerid, gLastPos[playerid][0], gLastPos[playerid][1], gLastPos[playerid][2]);
    return true;
}



Re: SetPlayerPos [Rep +1] - ZmaXy - 30.12.2011

Thanks man!

I give you 1 reputation