18.10.2012, 09:30
Hello i've two problems with my /spec command:
1) It doesn't save and load the position where you started spectating.
2) If a player enter in a vehicle, the camera view is bugged, it dont follows the player.
Here is:
Thank you very much
1) It doesn't save and load the position where you started spectating.
2) If a player enter in a vehicle, the camera view is bugged, it dont follows the player.
Here is:
pawn Код:
CMD:spec(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return 0;
new Float:xpoz,Float:ypoz,Float:zpoz;
GetPlayerPos(playerid,xpoz,ypoz,zpoz);
SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
new target;
if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/spec [playerid/name]");
else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Enter a valid player ID/name!");
TogglePlayerSpectating(playerid, true);
if(IsPlayerInAnyVehicle(target)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(target));
else PlayerSpectatePlayer(playerid, target);
SendClientMessage(playerid, COLOR_ORANGE, "Type /specoff to stop spectating.");
GameTextForPlayer(playerid,"~w~Type /specoff to stop spectating.",5000,5);
return 1;
}
CMD:specoff(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return 0;
SetPlayerPos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SetVehiclePos(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
TogglePlayerSpectating(playerid, false);
return 1;
}