Spec problem
#1

Well.. All the textdraw works now from my spectate,.. But if you spec someone and you do /spec off, The other admins can't spectate you.. And if i remove this line
pawn Код:
if(Spec[playerb] != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is spectating someone.");
then it will bug my textdraw what do i need to do

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(Spec[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.");
    PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
    new string[65];
    if(Spec[playerid] == INVALID_PLAYER_ID)
    {
        PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
        PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
        GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
    }
    Spec[playerid] = playerb;
    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
#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
#3

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
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;
}
Too bad, its not working... I don't know the problem, because the part that you gived me, doesnt work my textdraw at all, and if you want to spec someone its saying player bla..
Reply
#4

explain the problem please.
Reply
#5

As i said, i don't know the problem, only if you spectate someone, and you exit the spectate, And someone els want to spec you!, its says, this player is spectating someone, and if you remove that line, the textdraw from the last commands will be bugged..
Reply
#6

Quote:
Originally Posted by lulo356
Посмотреть сообщение
As i said, i don't know the problem, only if you spectate someone, and you exit the spectate, And someone els want to spec you!, its says, this player is spectating someone, and if you remove that line, the textdraw from the last commands will be bugged..
pawn Код:
if(playerb == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is spectating someone.");
Reply
#7

Works thanks.. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)