12.02.2011, 07:54
So.. I want to make an automatic speedtrap system.
This is the code from my speedo
And this is the speedtrap system. I setted it to sent cops a message but the speed is always 0.
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));
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);