removeplayer not work
#1

Hello
i did this code
pawn Код:
if(newcar == 304)
        {
         if(PlayerInfo[playerid][pAdmin] > 0) { }
          else if(!IsAnInstructor(playerid))
            {
                SendClientMessage(playerid,COLOR_GREY,"   only admins can drive on train !");
                RemovePlayerFromVehicle(playerid);
                TogglePlayerControllable(playerid, 1);
            }
        }
it's not remove the player from the vehicle
what to do?
it's train
it's send the client message but it's not removeplayerfromvehicle
Reply
#2

Did you put this under OnPlayerEnterVehicle? If so, you either need to move this piece of code to OnPlayerStateChange OR use ClearAnimations instead of RemovePlayerFromVehicle.
Reply
#3

yes i put this under OnPlayerEnterVehicle and it's not work
Reply
#4

how did you define "newcar" ?
Reply
#5

OnPlayerEnterVehicle is called when you press "Enter" or "F" (however), so you must use
Код:
TogglePlayerControllable(playerid,0); TogglePlayerControllable(playerid,1);
or

Код:
new x[3];
GetPlayerPos(playerid,x[0],x[1],x[2]);
SetPlayerPos(playerid,x[0]+random(3),x[1]+random(3),x[2]+random(2));
Reply
#6

What about setting a timer for removing player from vehicle ? Cause the OnPLayerEnter vehicle is called when player presses F and goes towards the vehicle to enter it. So tehnically, it is still not in it. Also the guy above's solution is a good one I guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)