SA-MP Forums Archive
removeplayer not work - 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: removeplayer not work (/showthread.php?tid=290107)



removeplayer not work - Chris_Morrison - 14.10.2011

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


Re: removeplayer not work - Vince - 14.10.2011

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.


Re: removeplayer not work - Chris_Morrison - 14.10.2011

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


AW: removeplayer not work - Drebin - 14.10.2011

how did you define "newcar" ?


Re: removeplayer not work - BloodMaster - 14.10.2011

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));



Re: removeplayer not work - sleepysnowflake - 14.10.2011

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.