CMD:spec(playerid,params[]) { if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return StopSpec(playerid); new id; if(sscanf(params, "u", id)) return SendError(playerid,"Use: /spec [ID]"); new mess[80 + MAX_PLAYER_NAME]; SpectatingIS(playerid); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id)); SetPlayerInterior(playerid, GetPlayerInterior(id)); TogglePlayerSpectating(playerid, true); if(IsPlayerInAnyVehicle(id)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id)); else PlayerSpectatePlayer(playerid, id); return 1; }
stock SpectatingIS(playerid) { statec[playerid] = true; GetPlayerPos(playerid, krd[playerid][0], krd[playerid][1], krd[playerid][2]); pInfo[playerid][world] = GetPlayerVirtualWorld(playerid); for(new slot = 0; slot < 13; slot ++) GetPlayerWeaponData(playerid,slot,weaps[playerid] [slot],amunition[playerid][slot]); pInfo[playerid][interior] = GetPlayerInterior(playerid); return 1; }
stock StopSpec(playerid) { statec[playerid] = true; SetPlayerPos(playerid, krd[playerid][0], krd[playerid][1], krd[playerid][2]); SetPlayerVirtualWorld(playerid, pInfo[playerid][world]); SetPlayerInterior(playerid,pInfo[playerid][interior]); TogglePlayerSpectating(playerid,false); if(pInfo[playerid][ant] == false) TogglePlayerControllable(playerid,true); for(new slot=0; slot < 13; slot++) GivePlayerWeaponEx(playerid,weaps[playerid][slot], amunition[playerid] [slot]); return 1; }
SetPlayerPos(playerid, krd[playerid][0], krd[playerid][1], krd[playerid][2]);
PHP код:
|
stock StopSpec(playerid) { statec[playerid] = true; SetSpawnInfo(playerid, 0, skin, krd[playerid][0], krd[playerid][1], krd[playerid][2], 0.0, 0, 0, 0, 0, 0, 0); TogglePlayerSpectating(playerid,false); SetPlayerVirtualWorld(playerid, pInfo[playerid][world]); SetPlayerInterior(playerid,pInfo[playerid][interior]); if(pInfo[playerid][ant] == false) TogglePlayerControllable(playerid,true); for(new slot=0; slot < 13; slot++) GivePlayerWeaponEx(playerid,weaps[playerid][slot], amunition[playerid] [slot]); return 1; }
new Float: PlayerPosX[MAX_PLAYERS], Float: PlayerPosY[MAX_PLAYERS], Float:PlayerPosZ[MAX_PLAYERS];//AT top
CMD:spec(playerid,params[])
{
new Float:x, Float:y, Float:z;
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return StopSpec(playerid);
new id;
if(sscanf(params, "u", id)) return SendError(playerid,"Use: /spec [ID]");
new mess[80 + MAX_PLAYER_NAME];
GetPlayerPos(playerid, x, y, z);
SpectatingIS(playerid);
PlayerPosX[playerid] = x;
PlayerPosY[playerid] = y;
PlayerPosZ[playerid] = z;
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
SetPlayerInterior(playerid, GetPlayerInterior(id));
TogglePlayerSpectating(playerid, true);
if(IsPlayerInAnyVehicle(id)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
else PlayerSpectatePlayer(playerid, id);
return 1;
}
stock StopSpec(playerid)
{
statec[playerid] = true;
SetPlayerPos(playerid, PlayerPosX[playerid], PlayerPosY[playerid], PlayerPosZ[playerid]);
SetPlayerVirtualWorld(playerid, pInfo[playerid][world]);
SetPlayerInterior(playerid,pInfo[playerid][interior]);
TogglePlayerSpectating(playerid,false);
if(pInfo[playerid][ant] == false) TogglePlayerControllable(playerid,true);
for(new slot=0; slot < 13; slot++) GivePlayerWeaponEx(playerid,weaps[playerid][slot], amunition[playerid][slot]);
return 1;
}