SA-MP Forums Archive
ChecKValidTextDraws remove the textdraw when it shouldnt - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ChecKValidTextDraws remove the textdraw when it shouldnt (/showthread.php?tid=457388)



ChecKValidTextDraws remove the textdraw when it shouldnt - thimo - 11.08.2013

Okay hello,

Im creating a textdraw wich is being checked every second... If its faulty its being removed. But now it does that also when its not faulty. This is my OnPlayerStateChange where its Showing up
pawn Код:
if(APlayerData[playerid][PlayerClass] == ClassPolice)
        {
            new vehid = GetPlayerVehicleID (playerid);
            if (VehRadarID [vehid] > -1) return 1;

            new Float: x, Float: y, Float: z, Float: a;
            GetVehiclePos (vehid, x, y, z);
            GetVehicleZAngle (vehid, a);

            for (new i = 0; i < MAX_PLAYERS; i++)
            {
                if (IsPlayerInVehicle (i, vehid))
                {
                    TextDrawShowForPlayer (i, RadarHud);
                }
            }
            if (VehRadarID [vehid] == -1) return 1;
            CheckingSpeed [vehid] = SetTimerEx ("UpdateSpeed", 100, 1, "d", vehid);
        }
This is the CheckValidTextDraws wich removes it after 1 sec.
pawn Код:
public CheckValidTextDraws()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected (i))
        {
            if (IsPlayerInAnyVehicle (i))
            {
                new vehid = GetPlayerVehicleID (i);
                if (VehRadarID [vehid] > -1)
                {
                    TextDrawShowForPlayer (i, RadarHud);
                    if (CheckingSpeed [vehid] > 0)
                    {
                        TextDrawShowForPlayer (i, SpeedAndModel [vehid]);
                    }
                    else
                    {
                        TextDrawHideForPlayer (i, SpeedAndModel [vehid]);
                    }
                }
                else
                {
                    TextDrawHideForPlayer (i, RadarHud);
                }
            }

            else
            {
                TextDrawHideForPlayer (i, RadarHud);
                TextDrawHideForPlayer (i, SpeedAndModel [OldVehID[i]]);
                OldVehID [i] = 0;
            }
        }
    }
    return 1;
}
Why is it getting removed? D: