21.02.2012, 23:23
Hay alguna forma de detectar si hay jugadores dentro del auto al que estas subido? osea, si hay alguien de player_state_passenger en el auto que estas subido. Gracias
PlayerVehicleHasPassengers(playerid)
{
if(!IsPlayerInAnyVehicle(playerid))return -1;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return -1;
new count;
for(new i, p=GetMaxPlayers(); i<p; i++)
if(IsPlayerConnected(i) && playerid != i && IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
count++;
if(count)return 1;
return 0;
}
Pero la usaria asi: if(PlayerVehicleHasPassengers(playerid)) ? podria saber quienes son los pasageros? osea, saber su faccion o job, etc. ? Gracias
|
PlayerVehicleHasPassengers(playerid, players[32])
{
if(!IsPlayerInAnyVehicle(playerid))return -1;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return -1;
new count;
for(new i, p=GetMaxPlayers(); i<p; i++)
if(IsPlayerConnected(i) && playerid != i && IsPlayerInVehicle(i, GetPlayerVehicleID(playerid))){
count++;
format(players, sizeof(players), "%s|%i", players, i);
}
if(count)return 1;
return 0;
}