SA-MP Forums Archive
Detecting RemovePlayerFromVehicle - 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: Detecting RemovePlayerFromVehicle (/showthread.php?tid=590450)



Detecting RemovePlayerFromVehicle - Rageparadise - 29.09.2015

EDT: Nevermind guys, I fixed it by using onplayerentervehicle instead of onplayerstatechange, cheers.

Alright so I'll make this simple for you guys to understand, I got house system as Filterscript which I don't want to implement inside the gamemode and I got antifall inside the gamemode which I can't implement inside that filterscript..

so I got this code for the antifall:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(Act[playerid] == 1)
	{
	        if(oldstate == PLAYER_STATE_DRIVER)
	        {
                if(newstate == PLAYER_STATE_ONFOOT)
                {
                        if(InCar[playerid] == 1)
                        {
                                if(GetVehicleModel(WhatCar[playerid]) != 441 ||
								 GetVehicleModel(WhatCar[playerid]) != 464 || GetVehicleModel(WhatCar[playerid]) != 465
								 || GetVehicleModel(WhatCar[playerid]) != 501 ||
								 GetVehicleModel(WhatCar[playerid]) != 564 ||
								 GetVehicleModel(WhatCar[playerid]) != 594) PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
                        }
                }
	        }
	        else if(oldstate == PLAYER_STATE_ONFOOT)
	        {
            	if(newstate == PLAYER_STATE_DRIVER)
                {
                        InCar[playerid] = 1;
                        WhatCar[playerid] = GetPlayerVehicleID(playerid);
                }
	        }
	}
	return 1;
}
and I got something like this when someone enters a house-car that isn't theirs:

Код:
RemovePlayerFromVehicle(playerid);
What happens is that I automatically get kicked off from the vehicle however antifall puts me back on because it thinks I fell to the ground from that vehicle.

One of the solutions would be to only enable anti fall for the spawned vehicles /car or /v but I'm wondering if you guys have a better way to detect if a player got ejected or if he fell.

Thank you for reading and I appreciate your time.