GetVehicleVelocity problem -
pantelimonfl - 12.02.2011
So.. I want to make an automatic speedtrap system.
This is the code from my speedo
pawn Код:
new String[128];
new Float:X, Float:Y, Float:Z, Float:Speed;
new vehicle = GetPlayerVehicleID(i);
GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 230);
format(String,sizeof(String),"~b~ D-Board~n~~r~Fuel: ~w~%i~n~~r~km/h: ~w~%i", Gas[vehicle], floatround(Speed, floatround_floor));
And this is the speedtrap system. I setted it to sent cops a message but the speed is always 0.
pawn Код:
new carid = GetPlayerVehicleID(playerid);
new Float:X, Float:Y, Float:Z, Float:viteza;
new vehicle = GetPlayerVehicleID(carid);
GetVehicleVelocity(GetPlayerVehicleID(carid), X, Y, Z);
viteza = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 230);
format(str,sizeof(str), "[RADAR] Car bla bla with speed %d!",viteza);//here the speed is 0
SendClientMessage(i, TEAM_BLUE_COLOR, str);
Re: GetVehicleVelocity problem -
pantelimonfl - 12.02.2011
up..
Re: GetVehicleVelocity problem -
Vince - 12.02.2011
pawn Код:
new carid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(GetPlayerVehicleID(carid), X, Y, Z);
Watch closely, and you'll see what you did wrong.
Re: GetVehicleVelocity problem -
pantelimonfl - 12.02.2011
I don't see anything
AW: Re: GetVehicleVelocity problem -
Nero_3D - 12.02.2011
Lets make it a bit more clear
new
carid =
GetPlayerVehicleID(
playerid);
GetVehicleVelocity(
GetPlayerVehicleID(
carid), X, Y, Z);
or if we put it together
GetVehicleVelocity(
GetPlayerVehicleID(
GetPlayerVehicleID(
playerid)), X, Y, Z);
And use %.0f instead of %d in format because its a float
Re: GetVehicleVelocity problem -
pantelimonfl - 12.02.2011
Solved. TC.
Re: GetVehicleVelocity problem -
pantelimonfl - 12.02.2011
I forgot. I want it to show the number plate, but it shows another text.
pawn Код:
new plate = CarInfo[vehicle][cPlate];
format(str,sizeof(str), "[RADAR] Masina mergand cu viteza de %i, numar : %s",floatround(viteza, floatround_floor), plate);
Re: GetVehicleVelocity problem -
pantelimonfl - 13.02.2011
Quote:
Originally Posted by pantelimonfl
I forgot. I want it to show the number plate, but it shows another text.
pawn Код:
new plate = CarInfo[vehicle][cPlate]; format(str,sizeof(str), "[RADAR] Masina mergand cu viteza de %i, numar : %s",floatround(viteza, floatround_floor), plate);
|
Up...
AW: GetVehicleVelocity problem -
Nero_3D - 13.02.2011
plate doesnt look like a string (%s) more like and int (%d, %i)
Re: GetVehicleVelocity problem -
pantelimonfl - 13.02.2011
even i put %d it show a stupid text.