Spectate problem
#1

Commands:

pawn Код:
if (strcmp(cmd, "/specplayer", true) == 0) // Moddded
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "SERVER: /specplayer [IDJucator/PARTEdinNUME]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                new Float:Health, Float:Armour;
                new World = GetPlayerVirtualWorld(playerid);
                new PlInterior = GetPlayerInterior(playerid);
                GetPlayerHealth(playerid, Health);
                GetPlayerArmour(playerid, Armour);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        Spectated[giveplayerid] = playerid;
                        PlayerInfo[playerid][pInt] = PlInterior;
                        PlayerInfo[playerid][pVirWorld] = World;
                        TogglePlayerSpectating(playerid, 1);
                        if(IsPlayerInAnyVehicle(giveplayerid)) { PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid)); }
                        else { PlayerSpectatePlayer(playerid, giveplayerid); }
                        Spectate[playerid] = giveplayerid;
                        SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "AdmCmd: %s il spioneaza pe %s (%d).", sendername, giveplayer, giveplayerid);
                        ABroadCast(COLOR_LIGHTRED, string, 5);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Acum il spionezi pe acest player. Pentru a te opri din spionat, utilizeaza /spionoff [IDJucator/PARTEdinNUME] ");
                        TextDrawShowForPlayer(playerid, Textdraw54[playerid]);
                        new y, m, d;
                        new h,mi,s;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s is speccing %s's",d,m,y,h,mi,s,sendername,giveplayer);
                        AdminLog(string);
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "   Jucatorul este Offline");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Nu esti autorizat sa folosesti aceasta comanda");
            }
        }
        return 1;
    }

    if (strcmp(cmd, "/specoff", true) == 0) // Moddded
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "SERVER: /specoff [IDJucator/PARTEdinNUME]");
                    return 1;
                }
                //giveplayerid = strval(tmp);
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        Spectated[giveplayerid] = 255;
                        TogglePlayerSpectating(playerid, 0);
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        TextDrawHideForPlayer(playerid, Textdraw54[playerid]);

                        TogglePlayerControllable(playerid, 1);
                        SetPlayerInterior(playerid,Unspec[playerid][sPint]);
                        PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
                        PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
                        Unspec[playerid][sLocal] = 255;
                        SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], Unspec[playerid][sPx],  Unspec[playerid][sPy], Unspec[playerid][sPz]-1.0, 1.0, -1, -1, -1, -1, -1, -1);
                        gTeam[playerid] = PlayerInfo[playerid][pTeam];
                        SetPlayerToTeamColor(playerid);
                        MedicBill[playerid] = 0;
                        if(PlayerInfo[playerid][pDonateRank] > 0)
                        {
                            SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], Unspec[playerid][Coords][0], Unspec[playerid][Coords][1], Unspec[playerid][Coords][2], 10.0, -1, -1, -1, -1, -1, -1);
                            SpawnPlayer(playerid);
                            SetCameraBehindPlayer(playerid);
                        }
                        else
                        {
                            SpawnPlayer(playerid);
                        }
                        Spectate[playerid] = 255;

                        new y, m, d;
                        new h,mi,s;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s is speccing %s's",d,m,y,h,mi,s,sendername,giveplayer);
                        AdminLog(string);
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "  Jucatorul este Offline");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Nu esti autorizat sa folosesti aceasta comanda");
            }
        }
        return 1;
    }
And functions:
pawn Код:
public Spectator()
{
    new string[450];
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(Spectate[i] != 255)
            {
                new targetid = Spectate[i];
                if(IsPlayerConnected(targetid))
                {
                    if(PlayerInfo[i][pAdmin] >= 1)
                    {
                        new Float:health,Float:armour,Float:health2;
                        new name[MAX_PLAYER_NAME];
                        new money = GetPlayerMoney(targetid);
                        new carid = GetPlayerVehicleID(targetid);
                        new Float:kmh = GetPlayerSpeed(targetid);
                        new bankmoney = PlayerInfo[targetid][pAccount];
                        GetPlayerName(targetid, name, sizeof(name));
                        GetPlayerHealth(targetid, health);
                        GetPlayerArmour(targetid, armour);
                        GetVehicleHealth(carid, health2);
                        if(!IsPlayerInAnyVehicle(targetid))
                        {
                            format(string, sizeof(string),"~p~- ~h~%s (ID: %d) ~p~-~n~~n~~n~ ~b~Viata: ~w~%.1f ~g~:-: ~b~Armura: ~w~%.1f ~n~ ~b~Bani: ~w~$%d ~g~:-: ~b~Banca: ~w~$%d",name,targetid,health,armour,money,bankmoney);
                            TextDrawSetString(Textdraw54[i],string);
                            PlayerSpectatePlayer(i, targetid);
                        }
                        else
                        {
                            format(string, sizeof(string),"~p~- ~h~%s (ID: %d) ~p~-~n~~n~~n~ ~b~Viata ~w~%.1f ~g~:-: ~b~Armura: ~w~%.1f ~n~ ~b~Bani: ~w~$%d ~g~:-: ~b~Banca: ~w~$%d ~n~~n~~g~---------------------------------------------------~n~~n~ ~b~ID Masina: ~w~%d ~b~HP masina: ~w~%.1f ~n~~n~~b~Viteza: ~w~%d",name,targetid,health,armour,money,bankmoney,carid,health2,kmh);
                            TextDrawSetString(Textdraw54[i],string);
                            PlayerSpectateVehicle(i, carid);
                        }
                    }
                    SetPlayerInterior(i,GetPlayerInterior(targetid));
                    SetPlayerVirtualWorld(i,GetPlayerVirtualWorld(targetid));
                }
            }
        }
    }
}
Is i Spec a player,a textdraw is created in the radar's place,but when i type /specoff, the textdraw is still there.
1. How can i move it?I can;t fine any coordinates
2. How can i destroy it when i type /specoff?
Reply
#2

Find all 'Textdraw54' from the script (Ctrl + F and F3 if using pawno)
Reply
#3

pawn Код:
new Text:Textdraw54[MAX_PLAYERS];
I found it like this,in the commands and in the public
Reply
#4

Quote:
Originally Posted by calin1996
Посмотреть сообщение
pawn Код:
new Text:Textdraw54[MAX_PLAYERS];
I found it like this,in the commands and in the public
TextDrawCreate too?
Reply
#5

No,i found the Textdraw54 in the NEW, in the Public, in the commands(/specplayer, /specoff),and that's all
Reply
#6

A litle help?
Reply
#7

Someone?(
Reply
#8

Have you tried "n00bscripter"'s idea?
Reply
#9

Yes,i've tried
Reply
#10

Try this then, not sure:

pawn Код:
TextDrawSetString(Textdraw54[i], "");
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)