PDA

View Full Version : SetPlayerPos [Rep +1]


ZmaXy
30/12/2011, 10:50 PM
I made this

CMD:port(playerid,params[])
{
#pragma unused params
SetPlayerPos(playerid,2048.9729,-1908.4037,13.5469);
return true;
}

CMD:portback(playerid,params[])
{
#pragma unused params
//How do I return to the coordinates where it was when he type / port
return true;
}

-Prodigy-
30/12/2011, 10:54 PM
Save the player's position like this: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;
}

ZmaXy
30/12/2011, 11:18 PM
Thanks man!

I give you 1 reputation :-)