23.04.2012, 03:47
Quote:
Hello, I need two commands:
- one to store my current position - and another one to teleport back to the position stored previously I tried something like this but failed: Code:
new position; COMMAND:SavePos(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return 1; new Float:x, Float:y, Float:z; position[playerid] = GetPlayerPos(playerid, x, y, z); return 1; } COMMAND:Back(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return 1; SetPlayerPos(playerid,position,0.0,0.0,3.0); return 1; } |
pawn Code:
new Float: PosX[MAX_PLAYERS];
new Float: PosY[MAX_PLAYERS];
new Float: PosZ[MAX_PLAYERS];
CMD:savepos(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PosX[playerid] = x;
PosY[playerid] = y;
PosZ[playerid] = z;
}
else SendClientMessage(playerid, -1,"You are not rcon admin.");
return 1;
}
CMD:loadpos(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
}
else SendClientMessage(playerid, -1,"You are not rcon admin.");
return 1;
}