Need Help - Spectate Textdraws
#1

hi guys,

my problem is I want to update the textdraws every second it's showing the textdraws but not updating it and I want to show all weapons in the textdraw but it's just showing only one weapon pls someone help. :\

my code is
pawn Код:
function StartSpectate( playerid, specplayerid )
{
    foreach(new x: Player)
        if ( GetPlayerState( x ) == PLAYER_STATE_SPECTATING && PlayerInfo[ x ][ SpecID ] == playerid )
           AdvanceSpectate( x );

    SetPlayerInterior( playerid, GetPlayerInterior( specplayerid ) );
    SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( specplayerid ) );
    TogglePlayerSpectating( playerid, 1 );
    SavePlayerCoords(playerid);

    if ( IsPlayerInAnyVehicle( specplayerid ) )
    {
        PlayerSpectateVehicle( playerid, GetPlayerVehicleID( specplayerid ) );
        PlayerInfo[ playerid ][ SpecID ]   = specplayerid;
        PlayerInfo[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_VEHICLE;
    }
    else
    {
        PlayerSpectatePlayer( playerid, specplayerid );
        PlayerInfo[ playerid ][ SpecID ]   = specplayerid;
        PlayerInfo[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_PLAYER;
    }

    gsString[ 0 ] = EOS;
    new
        Float:hp,
        Float:ar
    ;

    GetPlayerHealth( specplayerid, hp );
    GetPlayerArmour( specplayerid, ar );
    new ppPing = GetPlayerPing(specplayerid);
    new Float:ppPacket = GetPlayerPacketLoss(specplayerid);
   
    format( gsString, sizeof( gsString ), "~y~~h~FPS: ~r~~h~%d ~y~~h~Ping: ~r~~h~%d ~y~~h~PL: ~r~~h~%.1f%%",pFPS[specplayerid], ppPing, ppPacket  );
    PlayerTextDrawSetString(playerid, Spec_TD[1][playerid], gsString);
   
    format( gsString, sizeof( gsString ), "~g~~h~~h~%s [%d]",getPlayerName(specplayerid), specplayerid );
    PlayerTextDrawSetString(playerid, Spec_TD[2][playerid], gsString);
   
    format( gsString, sizeof( gsString ), "~y~~h~IP: ~r~~h~%s", GetPlayerIPEx(specplayerid) );
    PlayerTextDrawSetString(playerid, Spec_TD[3][playerid], gsString);
   
    format( gsString, sizeof( gsString ), "~y~~h~Health: ~r~~h~%.0f ~y~~h~Armour: ~r~~h~%.0f", hp, ar );
    PlayerTextDrawSetString(playerid, Spec_TD[4][playerid], gsString);
   
    format( gsString, sizeof( gsString ), "~y~~h~Money: ~g~~h~$~r~~h~%d", GetPlayerMoney( specplayerid ) );
    PlayerTextDrawSetString(playerid, Spec_TD[5][playerid], gsString);
   
    PlayerTextDrawShow(playerid, Spec_TD[0][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[6][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[1][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[2][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[3][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[4][playerid]);
    PlayerTextDrawShow(playerid, Spec_TD[5][playerid]);

        new
        slot,
        weap,
        ammos,
        Count,
        x
    ;

    for ( slot = 0; slot < 14; slot++ )
    {
        GetPlayerWeaponData( specplayerid, slot, weap, ammos );
        if ( ammos != 0 && weap != 0 ) Count++;
    }
    if ( Count < 1 )
        return format( gsString, sizeof( gsString ), "~r~~h~No Weapons", GetPlayerMoney( specplayerid ) ),
    PlayerTextDrawSetString(playerid, Spec_TD[7][playerid], gsString),
    PlayerTextDrawShow(playerid, Spec_TD[7][playerid]);

    gsString[ 0 ] = EOS;
    new
        WeapName[ 24 ]
    ;
    if ( Count >= 1 )
    {
        for ( slot = 0; slot < 14; slot++ )
        {
            GetPlayerWeaponData( specplayerid, slot, weap, ammos );
            if ( ammos != 0 && weap != 0 )
            {
                GetWeaponName( weap, WeapName, sizeof( WeapName ) );

                if ( ammos == 65535 || ammos == 1 )
                    format( gsString, sizeof( gsString ),"%s~y~~h~%s: ~r~~h~(1)~n~", gsString, WeapName );
                else
                    format( gsString, sizeof( gsString ),"%s~y~~h~%s: ~r~~h~(%d)~n~", gsString, WeapName, ammos );

                x++;
                if ( x >= 5 )
                {
                    PlayerTextDrawSetString(playerid, Spec_TD[7][playerid], gsString),
                    PlayerTextDrawShow(playerid, Spec_TD[7][playerid]);
                    x = 0;
                    format( gsString, sizeof( gsString ), "" );
                }
                else format( gsString, sizeof( gsString ), "%s,  ", gsString );
            }
        }
        if ( x <= 4 && x > 0 )
        {
            gsString[ strlen( gsString )-3 ] = '.';
            PlayerTextDrawSetString(playerid, Spec_TD[7][playerid], gsString),
            PlayerTextDrawShow(playerid, Spec_TD[7][playerid]);
        }
    }
    return ( 1 );
}
Reply


Messages In This Thread
Need Help - Spectate Textdraws - by Vaishnav - 11.05.2015, 08:43
Re: Need Help - Spectate Textdraws - by Crystallize - 11.05.2015, 10:09
Re: Need Help - Spectate Textdraws - by Yashas - 11.05.2015, 10:33
Re: Need Help - Spectate Textdraws - by Vaishnav - 11.05.2015, 10:43
Re: Need Help - Spectate Textdraws - by Vaishnav - 11.05.2015, 14:00
Re: Need Help - Spectate Textdraws - by Vaishnav - 12.05.2015, 02:57

Forum Jump:


Users browsing this thread: 1 Guest(s)