Speedometer problem.
#1

I'm having trouble getting a speedometer working. The mph is coming up in 10 thousands.

pawn Код:
new Float:ppos[3];
                new Float:vpos[3];
                new Float:pDist;
                GetPlayerPos(i, ppos[0], ppos[1], ppos[2]);
                pDist = floatsqroot(floatpower(floatabs(floatsub(ppos[0],vpos[0])),2)+floatpower(floatabs(floatsub(ppos[1],vpos[1])),2)+floatpower(floatabs(floatsub(ppos[2],vpos[2])),2));
                value = floatround(pDist, floatround_round);
                format(string, sizeof(string), "~g~ MPH: %d~n~ Fuel: %d", value, CarData[GetPlayerVehicleID(i)][Fuel]);
Reply
#2

Keep it simple: >>

pawn Код:
new
    Float: vX,
    Float: vY,
    Float: vZ,
    Float: Speed,
    string[32] // If you have mor chars just higher this..
;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
Speed = floatsqroot(floatpower(vX, 2) + floatpower(vY, 2) + floatpower(vZ, 2)) * 99;
format(string, sizeof(string), "Speed: %0.0f mp/h", Speed);
//TextDrawSetString(TD, string), TextDrawShowForPlayer(playerid, TD);
Reply
#3

Quote:
Originally Posted by » RyDeR «
Keep it simple: >>

pawn Код:
new
    Float: vX,
    Float: vY,
    Float: vZ,
    Float: Speed,
    string[32] // If you have mor chars just higher this..
;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
Speed = floatsqroot(floatpower(vX, 2) + floatpower(vY, 2) + floatpower(vZ, 2)) * 99;
format(string, sizeof(string), "Speed: %0.0f mp/h", Speed);
//TextDrawSetString(TD, string), TextDrawShowForPlayer(playerid, TD);
Can you explain the float functions I'm not too good with floats.
Reply
#4

lol, if your not good with floats how did you made Mapicon and Pickup streamer? :P
_________________________________________________
It's not difficult, you'll understand soon; For more info just surf to the wiki..
Reply
#5

Quote:
Originally Posted by » RyDeR «
lol, if your not good with floats how did you made Mapicon and Pickup streamer? :P
_________________________________________________
It's not difficult, you'll understand soon; For more info just surf to the wiki..
I mean't the functions, like floatsqroot, etc. The streamers just use IsPlayerInRangeOfPoint. Wiki doesn't have information on it.
Reply
#6

Speedmeter is to free download, look for some
Reply
#7

Quote:
Originally Posted by rabit7
Speedmeter is to free download, look for some
I didn't ask to download some. It was a problem that was fixed already.
Reply
#8

do you have any errors?
Reply
#9

Quote:
Originally Posted by rabit7
do you have errors?
Quote:
Originally Posted by Carlton
Quote:
Originally Posted by rabit7
Speedmeter is to free download, look for some
I didn't ask to download some. It was a problem that was fixed already.
Reply
#10

speedmeter is not too accurate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)