Frustrating Textdraws
#1

Hello, I have this loop with textdraw formats, it eventually gets bugged, also when a player connect it gets bugged also! Look:
pawn Код:
public UpdateTextdraw()
{
    new szString[40];
    new StatusString[64];
    foreach(Player, i)
    {
        // AFK
        if (GetPVarInt(i, "AFK") == 1) TextDrawShowForPlayer(i, afk);
        else if (GetPVarInt(i, "AFK") == 0) TextDrawHideForPlayer(i, afk);
        if (IsPlayerInAnyVehicle(i) && IsAirVehicle(GetPlayerVehicleID(i)))
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(i, X, Y, Z);
           
             // FUEL
            format(szString, 40, "Fuel:~w~ %d", Gas[GetPlayerVehicleID(i)]);
            TextDrawSetString(TD_0, szString);
           
            if (GetPVarInt(i, "Flight") > 0 || GetPVarInt(i, "Work") > 0)
            {
                new Float:Dist;
                Dist = GetDistanceBetweenPoints(X, Y, Z, IslandX[i], IslandY[i], IslandZ[i]);
                format(szString, 40, "DIST:~w~ %d", floatround(Dist, floatround_round));
                TextDrawSetString(TD_4, szString);
            }
            else
            {
                TextDrawSetString(TD_4, "DIST:~w~ None");
            }
           
            // DMG
            new Float:HP;
            GetVehicleHealth(GetPlayerVehicleID(i), HP);
            format(szString, 40, "DMG:~w~ %d", floatround(HP, floatround_round));
            TextDrawSetString(TD_3, szString);
           
            // ALT
           
            format(szString, 40, "ALT:~w~ %d", floatround(Z, floatround_ceil));
            TextDrawSetString(TD_5, szString);
           
            // VEHICLE
            format(szString, 40, "VEH:~w~ %s", GetVehicleFriendlyName(GetPlayerVehicleID(i)));
            TextDrawSetString(TD_6, szString);
           
            // STATUS
            if (GetPVarInt(i, "Work") > 0)
            {
                format(StatusString, 64, "Status:~w~ Work");
                TextDrawSetString(TD_7, StatusString);
            }
            else if (GetPVarInt(i, "Flight") == 1)
            {
                format(StatusString, 64, "~Status:~w~ On Route");
                TextDrawSetString(TD_7, StatusString);
            }
            else if (GetPVarInt(i, "Flight") == 0)
            {
                if (GetPVarInt(i, "Work") == 0)
                {
                    if (IsAirVehicle(GetPlayerVehicleID(i)))
                    {
                        format(StatusString, 64, "Status:~w~ Flying");
                        TextDrawSetString(TD_7, StatusString);
                    }
                    else
                    {
                        format(StatusString, 64, "Status:~w~ None");
                        TextDrawSetString(TD_7, StatusString);
                    }
                }
            }
           
            // HDG
            new Float:ZAngle;
            GetVehicleZAngle(GetPlayerVehicleID(i), ZAngle);
            format(szString, 40, "HDG:~w~ %d", floatround(ZAngle, floatround_round));
            TextDrawSetString(TD_8, szString);
           
            // Pilots
            format(szString, 40, "Pilots:~w~ %d/20", Count);
            TextDrawSetString(TD_11, szString);
           
            // Cash
            format(szString, 40, "Cash:~w~ %d", GetPlayerMoney(i));
            TextDrawSetString(TD_12, szString);
           
            // Tail
            format(szString, 40, "~w~%d-%s", VehicleTailNumber[GetPlayerVehicleID(i)][0], Tailnumbers[VehicleTailNumber[GetPlayerVehicleID(i)][1]]);
            TextDrawSetString(TD_17, szString);
           
            // Doors
            new engine, lights, alarm, doors, bonnet, boot, objective, szDoors[9];
            GetVehicleParamsEx(GetPlayerVehicleID(i), engine, lights, alarm, doors, bonnet, boot, objective);
            if (doors == 0) szDoors = "Unlocked";
            if (doors == 1) szDoors = "Locked";
           
            format(szString, 40, "Doors:~w~ %s", szDoors);
            TextDrawSetString(TD_10, szString);
           
            // DEST
            if (GetPVarInt(i, "Flight") > 0)
            {
                format(szString, 40, "DEST:~w~ %s", GetDestination(i));
            }
            else if (GetPVarInt(i, "Flight") == 0)
            {
                format(szString, 40, "DEST:~w~ %s", "None");
            }

            if (GetPVarInt(i, "Work") > 0)
            {
                format(szString, 40, "DEST:~w~ %s", GetDestination(i));
            }
            else if (GetPVarInt(i, "Work") == 0)
            {
                format(szString, 40, "DEST:~w~ %s", "None");
            }
            TextDrawSetString(TD_2, szString);
           
            // GPS
            format(szString, 40, "GPS:~w~ %s", GetPlayerArea(i));
            TextDrawSetString(TD_9, szString);
           
            // KMH
            if (IsPlayerInAnyVehicle(i))
            {
                new KMH_Sp = GetPlayerSpeed(i, true);
                format(szString, 40, "KMH:~w~ %d", floatround(KMH_Sp, floatround_round));
            }
            else
            {
                format(szString, 40, "KMH:~w~ %d", 0);
            }
            TextDrawSetString(TD_14, szString);
           
            // MPH
            if (IsPlayerInAnyVehicle(i))
            {
                new MPH_Sp = GetPlayerSpeed(i, false);
                format(szString, 40, "MPH:~w~ %d", floatround(MPH_Sp, floatround_round));
            }
            else
            {
                format(szString, 40, "MPH:~w~ %d", 0);
            }
            TextDrawSetString(TD_13, szString);
           
            // KNOTS
            if (IsPlayerInAnyVehicle(i))
            {
                new Float:KNT_Sp = GetPlayerSpeed(i, true) * 1.5;
                format(szString, 40, "KNOT:~w~ %d", floatround(KNT_Sp, floatround_round));
            }
            else
            {
                format(szString, 40, "KNOT:~w~ %d", 0);
            }
            TextDrawSetString(TD_15, szString);
        }
    }
    return 1;
}
GPS is saying wrong Location, the HP is wrong too, DIST and DEST are always 'None'. I don't know what to do, please help me.
Reply
#2

Wouldn't it be easier to modify your existing textdraw thread instead of spamming multiple threads?
Reply
#3

Quote:
Originally Posted by Norn
Посмотреть сообщение
Wouldn't it be easier to modify your existing textdraw thread instead of spamming multiple threads?
Well this is another problem different, with a different question.. I hope this is not bugging you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)