SA-MP Forums Archive
Textdraw bugged - 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: Textdraw bugged (/showthread.php?tid=553880)



Textdraw bugged - lulo356 - 01.01.2015

I got an little problem, when two players in the same range, and they both used a command, it will be bugged,

pawn Код:
public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
    if (id < 0)
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayerTextDrawSetString (i,RadarHud, "Speed:-");
            PlayerTextDrawSetString (i,VehicleModel,"Car Model:-");
        }
    }
    else
    {
        new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 187.666667, floatround_round);
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            format (str, sizeof (str), "Speed: %d", speed);
            PlayerTextDrawSetString (i,RadarHud, str);
            format (str, sizeof (str), "Car Model: %s", VehicleModel22 [GetVehicleModel (id) - 400]);
            PlayerTextDrawSetString (i,VehicleModel, str);
        }
    }
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerInVehicle (i, vehid))
        {
            PlayerTextDrawShow (i, RadarHud);
            PlayerTextDrawShow (i, DashCamText);
            PlayerTextDrawShow (i, VehicleModel);
        }
    }
    return 1;
}
pawn Код:
CMD:dcam(playerid, params[])
{
    if(DashCamActivated[playerid] == false)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehid = GetPlayerVehicleID (playerid);
            if(IsACop(playerid))
            {
                if (VehRadarID [vehid] == -1) return 1;
                {
                    CheckingSpeed [vehid] = SetTimerEx ("UpdateSpeed", 100, 1, "d", vehid);
                    PlayerTextDrawShow (playerid,RadarHud);
                    PlayerTextDrawShow (playerid,VehicleModel);
                    PlayerTextDrawShow (playerid,DashCamText);
                    DashCamActivated[playerid] = true;
                }
            }
        }
    }
    else
    {
        DashCamActivated[playerid] = false;
        new vehid = GetPlayerVehicleID (playerid);
        if(CheckingSpeed[vehid] > 0)
        {
            {
                KillTimer (CheckingSpeed [vehid]);
                CheckingSpeed [vehid] = -1;
                PlayerTextDrawHide (playerid, RadarHud);
                PlayerTextDrawHide (playerid, VehicleModel);
                PlayerTextDrawHide (playerid, DashCamText);
            }
        }
    }
    return 1;
}



Re: Textdraw bugged - Wizzy951 - 01.01.2015

I am a bit dizzy to think, but shouldn't you use a for loop in the command too ? Correct me if I'm wrong.


Re: Textdraw bugged - lulo356 - 01.01.2015

Quote:
Originally Posted by Wizzy951
Посмотреть сообщение
I am a bit dizzy to think, but shouldn't you use a for loop in the command too ? Correct me if I'm wrong.
Well, there is nothing wrong with the command, but there is just somting wrong when a player got you in his range, and you got his in your range, and both did /dcam You will see your car name, and your speed..


Re: Textdraw bugged - lulo356 - 01.01.2015

Someone?


Re: Textdraw bugged - iggy1 - 01.01.2015

What is the bug? Could you be a bit more specific please. At least then we will know which part of the code to look at.


Re: Textdraw bugged - lulo356 - 01.01.2015

for example you and me used /dcam you driving behind me and you are checking my speed and model, i aldo used /dcam normal you dont see npthing if you are not driving behind someone but if two or more player used /dcam and they are in the same range the textdraw will be bugged it will show some other cars that the other players thats used /dcam faced

(sended from my phone sorry bad english)