Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ACMD:spec(playerid, params[])
- {
- new Float:x, Float:y, Float:z;
- if(SpecStats == 0)
- {
- new id;
- if(pInfo[playerid][Adminlevel] < 2) return 0;
- if(sscanf(params,"u", id))
- if(id == INVALID_PLAYER_ID)return SCM(playerid, red, "Player not connected!");
- GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
- Inter[playerid] = GetPlayerInterior(playerid);
- vWorld[playerid] = GetPlayerVirtualWorld(playerid);
- TogglePlayerSpectating(playerid, true);
- if(IsPlayerInAnyVehicle(id))
- {
- if(GetPlayerInterior(id) > 0)
- {
- SetPlayerInterior(playerid,GetPlayerInterior(id));
- }
- if(GetPlayerVirtualWorld(id) > 0)
- {
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
- }
- PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
- }
- else
- {
- if(GetPlayerInterior(id) > 0)
- {
- SetPlayerInterior(playerid,GetPlayerInterior(id));
- }
- if(GetPlayerVirtualWorld(id) > 0)
- {
- SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
- }
- PlayerSpectatePlayer(playerid,id);
- }
- GetPlayerName(id, Name, sizeof(Name));
- GetPlayerPos(playerid, Float:x,Float:y,Float:z);
- format(String, sizeof(String),"You are spectating {33CCFF}%s.",Name);
- SCM(playerid, -1,String);
- IsSpecing[playerid] = 1;
- IsBeingSpeced[id] = 1;
- spectatorid[playerid] = id;
- SpecStats = 1;
- }
- else if(SpecStats == 1)
- {
- if(isnull(params))
- {
- if (pInfo[playerid][Adminlevel] < 2)
- if(IsSpecing[playerid] == 0)
- TogglePlayerSpectating(playerid, 0);
- SetPlayerPos(playerid, Float:x,Float:y,Float:z);
- SpecStats = 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment