22.01.2010, 16:19
EDIT USE THIS:
ON TOP OF THE SCRIPT UNDER INCLUDES:
OnPlayerCommandText:
ON TOP OF THE SCRIPT UNDER INCLUDES:
pawn Код:
enum SavePosENUM { Float:sX, Float:sY, Float:sZ, Float:sA, SavedPos };
new SavePos[MAX_PLAYERS][SavePosENUM];
pawn Код:
if(!strcmp(cmdtext, "/lp",true) || !strcmp(cmdtext,"/lpos",true))
{
if (SavePos[playerid][SavedPos] == 0) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Use /spos to save a position first!");
if (IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
} else {
SetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
SetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}
return SendClientMessage(playerid, COLOR_WHITE, "You have teleported to the last position you have saved.");
}
pawn Код:
if(!strcmp(cmdtext, "/spos",true) || !strcmp(cmdtext,"/sp",true)){ if (IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid), SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), SavePos[playerid][sA]);
}else {
GetPlayerPos(playerid, SavePos[playerid][sX], SavePos[playerid][sY], SavePos[playerid][sZ]);
GetPlayerFacingAngle(playerid, SavePos[playerid][sA]);
}SavePos[playerid][SavedPos] = 1;
return SendClientMessage(playerid, COLOR_WHITE, "Position saved.Use /lpos to go to the saved pos");
}