Posts: 4,930
Threads: 467
Joined: Dec 2010
https://sampwiki.blast.hk/wiki/GetPlayerState
pawn Код:
// FUNCION:
DriverSeatOccupied(vehicleid){
for (new user=0; user<GetMaxPlayers(); user++){
if(!IsPlayerConnected(user))continue;
if((IsPlayerInVehicle(user, vehicleid) && GetPlayerState(user)==PLAYER_STATE_DRIVER)return true;
}
return false;
}
pawn Код:
// EJEMPLO:
new vehicleid = GetPlayerVehicleID(playerid);
if(DriverSeatOccupied(vehicleid)){
// este vehiculo tiene el asiento del conductor ocupado
}else{
// este vehiculo tiene el asiento del conductor desocupado
}
pawn Код:
// FUNCION:
GetDriverSeatOccupied(vehicleid){
new occupied_id;
for (new user=0; user<GetMaxPlayers(); user++){
if(!IsPlayerConnected(user))continue;
if((IsPlayerInVehicle(user, vehicleid) && GetPlayerState(user)==PLAYER_STATE_DRIVER){occupied_id=user;}
}
return occupied_id;
}
pawn Код:
// EJEMPLO:
new vehicleid = GetPlayerVehicleID(playerid);
printf("en el vehiculo id:%d esta el jugador id:%d como conductor", vehicleid, GetDriverSeatOccupied(vehicleid) );