IF get vehicle speed?
#5

Why not do it like this.

Code:
static bool:IsSpeeding[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
	// Get the seat this determines everything about what the player is doing with
	// the vehicle and if they are even in one
	new seat = GetPlayerVehicleSeat(playerid);

	// Is the player speeding?
	if(IsSpeeding[playerid])
		// Can't be speeding if not in a vehicle
		if(seat == -1)
			IsSpeeding[playerid] = false;
		// Player is driving
		else if(seat == 0)
		{
			// Have they stopped speeding yet?
		    if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) <= 210)
		    {
				// Not speeding anymore let them know
		        IsSpeeding[playerid] = false;
		        SendClientMessage(playerid, COLOR_GREEN, "You have stopped speeding watch out for the cops");
			}
		}
	}
	// Player is not speeding
	else
	{
		// Player is driving
		if(seat == 0)
		{
			// Player is speeding issue the warning set as wanted
			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;
}
Reply


Messages In This Thread
IF get vehicle speed? - by Lixyde - 25.03.2019, 19:13
Re: IF get vehicle speed? - by Heress - 25.03.2019, 19:20
Re: IF get vehicle speed? - by 4D1L - 25.03.2019, 19:27
Re: IF get vehicle speed? - by SymonClash - 25.03.2019, 20:03
Re: IF get vehicle speed? - by Pottus - 25.03.2019, 20:27
Re: IF get vehicle speed? - by Lixyde - 26.03.2019, 18:42
Re: IF get vehicle speed? - by raydx - 26.03.2019, 19:24
Re: IF get vehicle speed? - by zepfiz - 27.03.2019, 17:29
Re: IF get vehicle speed? - by Lokii - 27.03.2019, 19:17

Forum Jump:


Users browsing this thread: 1 Guest(s)