02.09.2018, 14:34
The first part is the "checker":
You can use this code as a infinite timer and start it when OnGameModeInit get called.
The other way is: the "checker" get called only when the driver got out of the car or when anyother player enter in a vehicle.
Код:
forward TimerSlap(playerid); public TimerSlap(playerid) { if(GetPlayerVehicleSeat(playerid) > 0)//If the player is a passenger { for(new i = 0; i < MAX_PLAYERS; i++) //Loops through all players if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) return 1; //If did not found the driver, the passenger get slapped RemovePlayerFromVehicle(playerid);//Removing player from vehicle SendClientMessage(playerid, -1, "* There is no Driver in This Car ! Use F . "); } }
The other way is: the "checker" get called only when the driver got out of the car or when anyother player enter in a vehicle.