SA-MP Forums Archive
Changing mph to kmh - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changing mph to kmh (/showthread.php?tid=125808)



Changing mph to kmh - Chivava - 05.02.2010

Hello im using GTA RP edit and i want to change mph into kmh but then i'll get one little minor thing that looks weird.. As most peoples knows the max speed of 80 km/h isnt really high, but how do i edit it to be correct..
This is how it looks alike:

Код:
						if(gSpeedo[i] == 2)
						{
							if(distance <10)
							{
								format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph :  ~w~%.0f",distance);
							}
							if(distance > 10 && distance < 100)
							{
								format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
							}
							if(distance > 100)
							{
								format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
							}
							GameTextForPlayer(i, string, 2000, 5);
						}
						if(distance > maxspeed && PlayerInfo[i][pAdmin] < 1)
						{
							new tmpcar = GetPlayerVehicleID(i);
							if(!IsAPlane(tmpcar))
							{
								GetPlayerName(i, plname, sizeof(plname));
								format(string, 256, "[ADMIN] [%d]%s %.0f mph",i,plname,distance);
								ABroadCast(COLOR_YELLOW,string,1);
							}
						}
					}
				}



Re: Changing mph to kmh - MadeMan - 05.02.2010

Show the part where you have distance = ... or something like that.


Re: Changing mph to kmh - Chivava - 05.02.2010

public StoppedVehicle()
{
new Float,Float:y,Float:z;
new Float:distance,value;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
new VID;
VID = GetPlayerVehicleID(i);
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePla yerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 3600);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
if(SpeedMode)
{
}
if(value == 0)
{
Gas[VID]++;
}
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}
}
return 1;
}