SA-MP Forums Archive
PLAYER_STATE_DRIVER - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PLAYER_STATE_DRIVER (/showthread.php?tid=601287)



PLAYER_STATE_DRIVER - ratxrat - 19.02.2016

Im create restricted vehicles for police car.
PHP код:
new polisi[10];
//OnGameModeInit
polisi[0]=createvehicle(policecar)
polisi[1] = bla bla bla 
then onplayerstate
PHP код:
if(newstate == 2)
        {
              new 
CarCheck GetPlayerVehicleID(playerid);for (new 0MAX_PLAYERSc++)
            if(
CarCheck == Polisi[c])
            {
                   new 
playerState GetPlayerState(playerid);
                if(
playerState == PLAYER_STATE_DRIVER && PlayerInfo[playerid][pFaction] != 1)
                {
                    
                    
RemovePlayerFromVehicle(playerid);
                    
SendClientMessage(playeridCOLOR_RED"Kendaraan khusus Polisi");
                     return 
1;
                }
            }
}

that code not work, when im use this code
PHP код:
if(newstate == 2)
        {
              new 
CarCheck GetPlayerVehicleID(playerid);for (new 0MAX_PLAYERSc++)
            if(
CarCheck == Polisi[c])
            {
                   
                if( 
PlayerInfo[playerid][pFaction] != 1)
                {
                    
                    
RemovePlayerFromVehicle(playerid);
                    
SendClientMessage(playeridCOLOR_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 ^_^


Re: PLAYER_STATE_DRIVER - Pottus - 19.02.2016

You are creating / comparing vehicles in a very poor way to start with but if it helps https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat


Re: PLAYER_STATE_DRIVER - ratxrat - 19.02.2016

owh thank for link dude


Re: PLAYER_STATE_DRIVER - ratxrat - 19.02.2016

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