15.10.2014, 23:10
How can i fix this problem the textdraw is not showing up
pawn Код:
forward Speedometer(playerid);
public Speedometer(playerid)
{
new str[32],id, vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid != 0)
{
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667; // 250.666667 = kmph // 199,4166672 = mph
final_speed_int = floatround(final_speed,floatround_round);
format(speed_string,256,"Speed: %i",final_speed_int);
PlayerTextDrawSetString(playerid,Speed1, speed_string);
format (str, sizeof (str), "Model: %s", VehicleModel [GetVehicleModel (id) - 400]);
TextDrawSetString (Textdraw2, str);
}
else
{
PlayerTextDrawSetString(playerid, Speed1, "0");
PlayerTextDrawSetString(playerid, Model1, " ");
}
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
Speed1 = CreatePlayerTextDraw(playerid, 510.000000, 371.000000, "Speed:");
PlayerTextDrawBackgroundColor(playerid, Speed1, 255);
PlayerTextDrawFont(playerid, Speed1, 1);
PlayerTextDrawLetterSize(playerid, Speed1, 0.400000, 1.000000);
PlayerTextDrawColor(playerid, Speed1, -1);
PlayerTextDrawSetOutline(playerid, Speed1, 0);
PlayerTextDrawSetProportional(playerid, Speed1, 1);
PlayerTextDrawSetShadow(playerid, Speed1, 1);
PlayerTextDrawUseBox(playerid, Speed1, 1);
PlayerTextDrawBoxColor(playerid, Speed1, 255);
PlayerTextDrawTextSize(playerid, Speed1, 640.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Speed1, 0);
PlayerTextDrawShow(playerid,Speed1);
Dashcam1 = CreatePlayerTextDraw(playerid, 531.000000, 351.000000, "Dash Board");
PlayerTextDrawBackgroundColor(playerid, Dashcam1, 255);
PlayerTextDrawFont(playerid, Dashcam1, 1);
PlayerTextDrawLetterSize(playerid, Dashcam1, 0.400000, 2.000000);
PlayerTextDrawColor(playerid, Dashcam1, 16777215);
PlayerTextDrawSetOutline(playerid, Dashcam1, 1);
PlayerTextDrawSetProportional(playerid, Dashcam1, 1);
PlayerTextDrawSetSelectable(playerid, Dashcam1, 0);
PlayerTextDrawShow(playerid,Dashcam1);
Model1 = CreatePlayerTextDraw(playerid, 510.000000, 399.000000, "Model:");
PlayerTextDrawBackgroundColor(playerid, Model1, 255);
PlayerTextDrawFont(playerid, Model1, 1);
PlayerTextDrawLetterSize(playerid, Model1, 0.319999, 1.000000);
PlayerTextDrawColor(playerid, Model1, -1);
PlayerTextDrawSetOutline(playerid, Model1, 1);
PlayerTextDrawSetProportional(playerid, Model1, 1);
PlayerTextDrawUseBox(playerid, Model1, 1);
PlayerTextDrawBoxColor(playerid, Model1, 255);
PlayerTextDrawTextSize(playerid, Model1, 660.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, Model1, 0);
PlayerTextDrawShow(playerid,Model1);
return 1;
}