23.06.2018, 13:46
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.
Any solutions or alternatives?
Код:
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; }