22/06/2022 23:45
(Esta mensagem foi modificada pela última vez a: 22/06/2022 23:46 por MarcosBrazz.)
Altere para:
Coloque fora de callbacks:
OBS: É recomendado a utilização do foreach para esse tipo de loop.
Código:
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && !VehicleAsDriver(GetPlayerVehicleID(playerid)))
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+0.5);
return SendClientMessage(playerid, COR_ERRO, "| INFO | O Seu veículo não tem motorista!");
}
Código:
stock VehicleAsDriver(vehicleid){
new stats = 0;
for(new i; i < MAX_PLAYERS; i++){
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) {
stats = 1;
break;
}
}
return stats;
}