26.03.2019, 18:42
So i added what SymonClash said.
and added what Pottus
It works. But not everything.
The full code:
1. I have argument mismatch on:
and on:
I tried changing 210 with 210.0 and again its the same.
2. When i decrease my vehicle speed and gets below 210. it should send the message:
But it doesnt work?. There is no message send
and added what Pottus
It works. But not everything.
The full code:
Code:
new IsWanted[MAX_PLAYERS];
static bool:IsSpeeding[MAX_PLAYERS];
GetVehicleSpeed(vehicleid, type)
{
//Type 1: MPH - Any other type: KM/H
//GetVehicleSpeed(GetPlayerVehicleID(playerid), 1);
new s;
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid, x, y, z);
switch(type)
{
case 1: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*112.1577, floatround_round);
default: s = floatround((floatsqroot(floatpower(x, 2) + floatpower(y, 2) + floatpower(z, 2)))*180.5000, floatround_round);
}
return s;
}
public OnPlayerUpdate(playerid)
{
new seat = GetPlayerVehicleSeat(playerid);
if(IsSpeeding[playerid])
{
if(seat == -1)
{
IsSpeeding[playerid] = false;
}
if(seat == 0)
{
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) <= 210)
{
IsSpeeding[playerid] = false;
SendClientMessage(playerid, COLOR_RED, "You stopped driving fast, watch out for the cops");
}
}
}
else
{
if(seat == 0)
{
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 210)
{
SendClientMessage(playerid, COLOR_RED, "You are drivin too fast, thw cops are going to chase you now!");
IsWanted[playerid] = 1;
}
}
}
return 1;
}
1. I have argument mismatch on:
Code:
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) <= 210)
Code:
if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 210)
2. When i decrease my vehicle speed and gets below 210. it should send the message:
Code:
SendClientMessage(playerid, COLOR_RED, "You stopped driving fast, watch out for the cops");

