#include <a_samp>
new Float:coord[4], veh;
new SavedPos[MAX_PLAYERS], WasInVeh[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/sp\", cmdtext, true, 10) == 0) { return SavePos(playerid); }
if (strcmp(\"/lp\", cmdtext, true, 10) == 0) { return LoadPos(playerid); }
if (strcmp(\"/delpos\", cmdtext, true, 10) == 0) { return SavedPos[playerid] = 0; }
return 0;
}
SavePos(playerid)
{
if (IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid), coord[0], coord[1], coord[2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), coord[3]);
WasInVeh[playerid] = 1;
veh = GetPlayerVehicleID(playerid);
} else {
GetPlayerPos(playerid, coord[0], coord[1], coord[2]);
GetPlayerFacingAngle(playerid, coord[3]);
WasInVeh[playerid] = 0;
}
SavedPos[playerid] = 1;
return SendClientMessage(playerid, 0x33AA33AA, \"Pozíció lementve!\");
}
LoadPos(playerid)
{
if (SavedPos[playerid] == 0) return SendClientMessage(playerid, 0x33AA33AA, \"Pozició nincs mentve.\");
if (IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), coord[0], coord[1], coord[2] + 1);
SetVehicleZAngle(GetPlayerVehicleID(playerid), coord[3]);
if (WasInVeh[playerid] == 1){ PutPlayerInVehicle(playerid, veh, 0); }
} else {
SetPlayerPos(playerid, coord[0], coord[1], coord[2]);
SetPlayerFacingAngle(playerid, coord[3]);
}
return SendClientMessage(playerid, 0x33AA33AA, \"Elteleportáltál a mentett pozícióra!\");
}
By Baliboy