SA-MP Forums Archive
Speed problem - 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: Speed problem (/showthread.php?tid=592862)



Speed problem - fuckingcruse - 30.10.2015

When i do enter the vehicle , it shows 25 directly before i drive

Код:
//stock]
stock GetPlayerSpeed(playerid,bool:kmh) // by misco
{
    new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
    if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
    rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
    return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}

//Onplayerentervehicle
	new kmh = GetPlayerSpeed(playerid, true);
    new string[124];
 	if(kmh >= 0 && kmh <= 80)
	{
		format(string, 64, "~w~Speed: ~g~~h~%d ~w~KM/h.", kmh);
	}
	else if(kmh >= 81 && kmh <= 120)
	{
		format(string, 64, "~w~Speed: ~y~~h~%d ~w~KM/h.", kmh);
	}
		else if(kmh >= 121)
	{
	format(string, 64, "~w~Speed: ~r~~h~%d ~w~KM/h.", kmh);
	}
Anyone here to help?


Re: Speed problem - iFiras - 30.10.2015

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
it shows 25 directly before i drive
Does the amount change after showing 25?
If it does, after how much time?


Re: Speed problem - fuckingcruse - 30.10.2015

It does like 10-15secs it changes always


Re: Speed problem - iFiras - 30.10.2015

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
It does like 10-15secs it changes always
I think you should change the textdraw string because everytime the textdraw will be shown, it'll always show its default string.

I think you have something like:
pawn Код:
textdraw = TextDrawCreate(x, y, "text");
If you show the textdraw without changing the string (TextDrawSetString), it'll always show the default string which is "text" in this case.


Re: Speed problem - fuckingcruse - 30.10.2015

Код:
	Textdraw39[playerid] = TextDrawCreate(498.000000, 123.000000, ""); // speedo
	TextDrawBackgroundColor(Textdraw39[playerid], 255);
	TextDrawFont(Textdraw39[playerid], 1);
	TextDrawLetterSize(Textdraw39[playerid], 0.389899, 1.299900);
	TextDrawColor(Textdraw39[playerid], 13107455);
	TextDrawSetOutline(Textdraw39[playerid], 1);
	TextDrawSetProportional(Textdraw39[playerid], 1);
	TextDrawShowForPlayer(playerid, Textdraw39[playerid]);
Text draw codes


Re: Speed problem - fuckingcruse - 30.10.2015

Actually needs help. I tried my best nothing comes out. Help me please guys?


Re: Speed problem - fuckingcruse - 31.10.2015

BUMB 24hrs up after some time!