Spec problem
#2

pawn Код:
CMD:spec(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!strcmp(params, "off", true))
    {
        if(Spec[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "You aren't spectating anybody.");
        TogglePlayerSpectating(playerid, 0);
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        SetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
        PlayerTextDrawHide(playerid, Health1);
        PlayerTextDrawHide(playerid, Money);
        PlayerTextDrawHide(playerid, Name);
        PlayerTextDrawHide(playerid, Armour1);
        PlayerTextDrawHide(playerid, IP1);
        PlayerTextDrawHide(playerid, sCMD0);
        PlayerTextDrawHide(playerid, sCMD1);
        PlayerTextDrawHide(playerid, sCMD2);
        PlayerTextDrawHide(playerid, sCMD3);
        PlayerTextDrawHide(playerid, sCMD4);
        return 1;
    }
    new playerb;
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /spec [playerid]");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't spectate yourself.");
    if(!IsPlayerLoggedIn(playerb) || !IsPlayerConnected(playerb) || playerb == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(playerb != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is spectating someone.");
    if(!PlayerInfo[playerb][pTutorial]) SendClientMessage(playerid, COLOR_WHITE, " That player is viewing the tutorial, don't assume he's using hacks yet.");
    if(playerb == INVALID_PLAYER_ID) return true;
    PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
    new string[65];
    TogglePlayerSpectating(playerid, 1);
    SetPlayerInterior(playerid, GetPlayerInterior(playerb));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerb));
    PlayerTextDrawShow(playerid, Health1);
    PlayerTextDrawShow(playerid, Money);
    PlayerTextDrawShow(playerid, Name);
    PlayerTextDrawShow(playerid, Armour1);
    PlayerTextDrawShow(playerid, IP1);
    PlayerTextDrawShow(playerid, sCMD0);
    PlayerTextDrawShow(playerid, sCMD1);
    PlayerTextDrawShow(playerid, sCMD2);
    PlayerTextDrawShow(playerid, sCMD3);
    PlayerTextDrawShow(playerid, sCMD4);
    if(IsPlayerInAnyVehicle(playerb)) PlayerSpectateVehicle(playerid, GetPlayerVehicleID(playerb));
    else PlayerSpectatePlayer(playerid, playerb);
    if(PlayerInfo[playerb][pAdmin] >= PlayerInfo[playerid][pAdmin])
    {
        format(string, sizeof(string), "SpecWarn: You are spectating %s.", RPN(playerb));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    return 1;
}
Reply


Messages In This Thread
Spec problem - by lulo356 - 02.12.2014, 22:20
Respuesta: Spec problem - by jotajeda - 02.12.2014, 23:49
Re: Respuesta: Spec problem - by lulo356 - 03.12.2014, 00:04
Respuesta: Spec problem - by jotajeda - 03.12.2014, 00:14
Re: Spec problem - by lulo356 - 03.12.2014, 00:23
Respuesta: Re: Spec problem - by jotajeda - 03.12.2014, 00:28
Re: Spec problem - by lulo356 - 03.12.2014, 01:19

Forum Jump:


Users browsing this thread: 2 Guest(s)