06.11.2015, 08:26
Two stocks I've made for my gamemode that can help:
IsVehicleOccupied(vehicleid) - Simply checks if there's someone in a vehicle. Good for /respawncars commands and such.
GetDriverID(vehicleid) - Returns the ID of the vehicle's driver (returns -1 if there is no driver).
IsVehicleOccupied(vehicleid) - Simply checks if there's someone in a vehicle. Good for /respawncars commands and such.
Quote:
stock IsVehicleOccupied(vehicleid) { for (new i=0, j=MAX_PLAYERS; i<j; i++) { if(GetPlayerVehicleID(i) == vehicleid) { return true; } } return false; } |
Quote:
stock GetDriverID(vehicleid) { for (new i=0, j=MAX_PLAYERS; i<j; i++) { if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i)==PLAYER_STATE_DRIVER) { return i; } } return -1; } |