PDA

View Full Version : Textdraw bug


lulo356
07/01/2015, 10:52 PM
When two players used the same command it will bugs the textdraw, it will show the other players information,

public UpdateSpeed (playerid,vehid)
{
new id = GetVehicleInfrontID (playerid);
if (id < 0)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
PlayerTextDrawSetString (i,RadarHud[i], "Speed:-");
PlayerTextDrawSetString (i,VehicleModel221[i],"Car Model:-");
}
}
else
{
new str[258], 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[i], str);
format (str, sizeof (str), "Car Model: %s", VehicleModel22 [GetVehicleModel (id) - 400]);
PlayerTextDrawSetString (i,VehicleModel221[i], str);
}
}
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInVehicle (i, vehid))
{
PlayerTextDrawShow (i, RadarHud[i]);
PlayerTextDrawShow (i, DashCamText);
PlayerTextDrawShow (i, VehicleModel221[i]);
}
}
return 1;
}

public CheckValidTextDraws()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected (i))
{
if (IsPlayerInAnyVehicle (i))
{
new vehid = GetPlayerVehicleID (i);
if (VehRadarID [vehid] > -1)
{
PlayerTextDrawShow (i, RadarHud[i]);
PlayerTextDrawShow (i, DashCamText);
PlayerTextDrawShow (i, VehicleModel221[i]);
if (CheckingSpeed [vehid] > 0)
{
PlayerTextDrawShow (i, RadarHud[i]);
PlayerTextDrawShow (i, DashCamText);
PlayerTextDrawShow (i, VehicleModel221[i]);
}
else
{
PlayerTextDrawHide (i, RadarHud[i]);
PlayerTextDrawHide (i, DashCamText);
PlayerTextDrawHide(i, VehicleModel221[i]);
}
}
else
{
PlayerTextDrawHide (i, RadarHud[i]);
PlayerTextDrawHide (i, DashCamText);
PlayerTextDrawHide(i, VehicleModel221[i]);
OldVehID [i] = 0;
}
}
}
}
return 1;
}

Divergent
07/01/2015, 11:40 PM
You need to create a textdraw for each player

new textdraw[MAX_PLAYERS];

then show textdraw[playerid]

(textdraw = name of any textdraw)

lulo356
07/01/2015, 11:49 PM
You need to create a textdraw for each player

new textdraw[MAX_PLAYERS];

then show textdraw[playerid]

(textdraw = name of any textdraw)

Already have that man, and that doenst work.