25.03.2019, 19:27
Quote:
|
So i when you pass 210 KM in your car it should send the message that you are driving too fast.
I tried it, but something doesnt work. Code:
stock GetVehicleSpeed(vehicleid)
{
new Float:vx, Float:vy, Float:vz, Float:vel;
vel = GetVehicleVelocity(vehicleid, vx, vy, vz);
vel = (floatsqroot(((vx*vx)+(vy*vy))+(vz*vz))* 181.5);
return Float:vel;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public VehicleSpeed(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 210)
{
SendClientMessage(playerid, COLOR_RED, "You drive too fast, cops are going to chase you now!");
IsWanted[playerid] = 1;
}
}
return 1;
}
2. It doesnt work at all, im passing 210 KMH and more, but there is no message. help? |
I would change your function signature to this: Float:GetVehicleSpeed(vehicleid). By adding a float tag to the function header, you are telling the compiler you are going to be returning a float.
As such, the line `return Float:vel` would become `return vel` as the function is expected to return a floating point number because of how we used the tag Float.


