14.06.2012, 05:46
Hi, When I type /spectate .. I want it to save player position and then If I type /specoff and it will set the player's position to the saved position.Can someone help me to do it? I don't know how to.Please Help . Here's my spectate and specoff codes :
Код:
dcmd_spectate(playerid,params[]) { new string[128]; new ID; if(sscanf(params,"u",ID)) { SendClientMessage(playerid,COLOR_ERROR,"USAGE: /spectate (Player Name/ID)"); return 1; } if(!IsPlayerConnected(ID)) { format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot spectate them.",ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command."); return 1; } if(playerid == ID) { SendClientMessage(playerid,COLOR_ERROR,"You cannot spectate yourself, how could that even be possible?"); return 1; } if(IsSpawned[ID] != 1) { format(string,sizeof(string),"%s(%d) is not spawned. You cannot place spectate dead people ..",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(IsPlayerInAnyVehicle(ID)) { new vehid = GetPlayerVehicleID(ID); TogglePlayerSpectating(playerid, 1); PlayerSpectateVehicle(playerid, vehid); SetPlayerInterior(playerid,GetPlayerInterior(ID)); SpectatingPlayer[playerid] =ID; IsBeingSpectated[ID] =1; return 1; } TogglePlayerSpectating(playerid, 1); PlayerSpectatePlayer(playerid, ID); SetPlayerInterior(playerid,GetPlayerInterior(ID)); SpectatingPlayer[playerid] =ID; IsBeingSpectated[ID] =1; return 1; } dcmd_specoff(playerid,params[]) { #pragma unused params if(SpectatingPlayer[playerid] == -1) { SendClientMessage(playerid,COLOR_ERROR,"You are not spectating a player. How can you spectating them?"); return 1; } TogglePlayerSpectating(playerid,0); IsBeingSpectated[SpectatingPlayer[playerid]] =0; SpectatingPlayer[playerid] =-1; return 1; }