Speedometer is lost. -
Supernovaa - 29.10.2015
Hi.
I have a Speedometer but when i put new textdraw for the script, the Speedometer is lost.
Please somebody help.
Thanks.
Sorry for bad English.
Re: Speedometer is lost. -
Ritzy2K - 29.10.2015
Providing some code will help lol.
Re: Speedometer is lost. -
Supernovaa - 29.10.2015
Код:
public Speedometer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new vehicleid, Float:health;
new fstring[32], string[512];
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid, health);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
string = "~w~";
strcat(string, "~w~~h~Benzin: ~g~", sizeof(string));
fstring = "iiiiiiiiii";
if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
strcat(string, fstring, sizeof(string));
strcat(string, "~n~~w~~h~", sizeof(string));
if(GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d", GetPlayerSpeed(i, false));
else format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, true));
strcat(string, fstring, sizeof(string));
TextDrawSetString(SpeedoText[i], string);
}
}
}
Re: Speedometer is lost. -
SecretBoss - 29.10.2015
Try to hide the textdraws when the player enter the car and he leaves show them again
Re: Speedometer is lost. -
Supernovaa - 29.10.2015
SecretBoss.
That's not problem, because it's working.
My problem is: When i put, this script for the scriptfiles. =
http://samp-mods.com/files/file5402.html the speedometer doesn't work.
AW: Speedometer is lost. -
Mencent - 29.10.2015
Hello!
I think you reached the limit of the global textdraws.
Please change your speedometer-code (global textdraws -> player textdraws).
I give you the wiki page to look up for help.
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Re: Speedometer is lost. -
Supernovaa - 29.10.2015
How i can editing?
AW: Speedometer is lost. -
Mencent - 29.10.2015
Here is a little example:
PHP код:
new Text:TextDraw;
//OnGameModeInit
TextDraw = TextDrawCreate(450.0,230.0,"My textdraw");
TextDrawFont(TextDraw,0);
TextDrawLetterSize(TextDraw,1.0,0.4);
// ^^ becomes:
new PlayerText:TextDraw[MAX_PLAYERS];
//OnPlayerConnect
TextDraw[playerid] = CreatePlayerTextDraw(playerid,450.0,230.0,"My textdraw");
PlayerTextDrawFont(playerid,TextDraw[playerid],0);
PlayerTextDrawLetterSize(playerid,TextDraw[playerid],1.0,0.4);
Re: Speedometer is lost. -
Supernovaa - 29.10.2015
Not working.
AW: Speedometer is lost. -
Mencent - 29.10.2015
Can you show us your code, please?