OnPlayerExitVehicle
#1

Hello. I'm trying to make a code that will put a player back into their vehicle if they try and exit within 3 seconds of just recently entering it. I seem to be having some trouble with it though as it does not execute PutPlayerInVehicle.

Код:
new RecentEnterExit[MAX_PLAYERS];


forward RecentEnterExitt(playerid);
public RecentEnterExitt(playerid)
{
	RecentEnterExit[playerid] = 0;
	return 1;
}
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{

	RecentEnterExit[playerid] = 1;
	SetTimerEx("RecentEnterExitt", 3000, false, "i", playerid);
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	new carid = GetPlayerVehicleID(playerid);
    if(RecentEnterExit[playerid] == 1)
    {
		PutPlayerInVehicle(playerid, carid, 0);
		SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot exit so soon.");
    }
	return 1;
}
Any solutions or alternatives?
Reply


Messages In This Thread
OnPlayerExitVehicle - by Zmith - 23.06.2018, 13:46
Re: OnPlayerExitVehicle - by Lokii - 23.06.2018, 14:05
Re: OnPlayerExitVehicle - by Zmith - 23.06.2018, 14:27

Forum Jump:


Users browsing this thread: 1 Guest(s)