PDA

View Full Version : PLAYER_STATE_DRIVER


ratxrat
19/02/2016, 02:14 PM
Im create restricted vehicles for police car.
new polisi[10];

//OnGameModeInit
polisi[0]=createvehicle(policecar)
polisi[1] = bla bla bla


then onplayerstate

if(newstate == 2)
{
new CarCheck = GetPlayerVehicleID(playerid);for (new c = 0; c < MAX_PLAYERS; c++)
if(CarCheck == Polisi[c])
{
new playerState = GetPlayerState(playerid);
if(playerState == PLAYER_STATE_DRIVER && PlayerInfo[playerid][pFaction] != 1)
{

RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Kendaraan khusus Polisi");
return 1;


}
}
}
}

that code not work, when im use this code
if(newstate == 2)
{
new CarCheck = GetPlayerVehicleID(playerid);for (new c = 0; c < MAX_PLAYERS; c++)
if(CarCheck == Polisi[c])
{

if( PlayerInfo[playerid][pFaction] != 1)
{

RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Kendaraan khusus Polisi");
return 1;


}
}
}
}
this work , but when passanger get in to car eject from car. i want eject just driver when not at faction. any solution??

sory for my bad english ^_^

Pottus
19/02/2016, 02:33 PM
You are creating / comparing vehicles in a very poor way to start with but if it helps https://wiki.sa-mp.com/wiki/GetPlayerVehicleSeat

ratxrat
19/02/2016, 02:39 PM
owh thank for link dude :)

ratxrat
19/02/2016, 03:37 PM
code work now but just fagio not work. i create 4 fagio with aray but just fagio[0] eject driver , other fagio cannot eject driver and same case with pizza bike . IDK where my mistake i use same code like code for police .

police car work but fagio and pizza bike not work