Gastonito Posted January 23, 2017 Share Posted January 23, 2017 Hello guys, i need a little function that disables car leaving, it's supposed to get executed on a gui button click, but i can link it later, just need the func Link to comment
aka Blue Posted January 23, 2017 Share Posted January 23, 2017 Cancel on onVehicleStartExit Link to comment
Captain Cody Posted January 23, 2017 Share Posted January 23, 2017 (edited) function exitingVehicle(player) if player == localPlayer then cancelEvent() end end addEventHandler("onClientVehicleStartExit", getRootElement(), exitingVehicle) Or if you want globally addEventHandler("onVehicleStartExit", getRootElement(), cancelEvent) Edited January 23, 2017 by CodyJ(L) Link to comment
Gastonito Posted January 23, 2017 Author Share Posted January 23, 2017 (edited) DELETED 17 minutes ago, CodyJ(L) said: function exitingVehicle(player) if player == localPlayer then cancelEvent() end end addEventHandler("onClientVehicleStartExit", getRootElement(), exitingVehicle) Or if you want globally addEventHandler("onVehicleStartExit", getRootElement(), cancelEvent) Cody i want it on this structure : addEvent("eventFeezePlayers", true) function eventFeezePlayers() for eventPlayers in pairs(WrapedPlayers) do toggleAllControls ( eventPlayers, false ) exports.SAEGcommands:sendMessage(getPlayerName(client).." Has Frozen You !", 255, 0, 0,eventPlayers) end end addEventHandler("eventFeezePlayers", root, eventFeezePlayers ) So how will it be ? Edited January 23, 2017 by Angel02 Link to comment
Captain Cody Posted January 23, 2017 Share Posted January 23, 2017 ? addEvent("eventFeezePlayers", true) function eventFeezePlayers() addEventHandler("onVehicleStartExit", getRootElement(), cancelEvent) for eventPlayers in pairs(WrapedPlayers) do toggleAllControls ( eventPlayers, false ) exports.SAEGcommands:sendMessage(getPlayerName(client).." Has Frozen You !", 255, 0, 0,eventPlayers) end end addEventHandler("eventFeezePlayers", root, eventFeezePlayers ) That's assuming it's all players. Link to comment
Gastonito Posted January 23, 2017 Author Share Posted January 23, 2017 2 minutes ago, CodyJ(L) said: ? addEvent("eventFeezePlayers", true) function eventFeezePlayers() addEventHandler("onVehicleStartExit", getRootElement(), cancelEvent) for eventPlayers in pairs(WrapedPlayers) do toggleAllControls ( eventPlayers, false ) exports.SAEGcommands:sendMessage(getPlayerName(client).." Has Frozen You !", 255, 0, 0,eventPlayers) end end addEventHandler("eventFeezePlayers", root, eventFeezePlayers ) That's assuming it's all players. No no u dont undrestand, i want the function of disabling vehicle exit to be with the same structure as the other one :v Link to comment
Captain Cody Posted January 23, 2017 Share Posted January 23, 2017 (edited) noExit = {} addEvent("eventNoVehiclePlayers", true) function eventNoVehiclePlayers() for eventPlayers in pairs(WrapedPlayers) do noExit[eventPlayers] = true exports.SAEGcommands:sendMessage(getPlayerName(client).." Has removed yeah ability to exit vehicle !", 255, 0, 0,eventPlayers) end end addEventHandler("eventNoVehiclePlayers", root, eventNoVehiclePlayers ) function noExitAye(player) if noExit[player] then cancelEvent() end end addEventHandler("onVehicleStartExit", getRootElement(), noExitAye) Edited January 23, 2017 by CodyJ(L) Link to comment
Gastonito Posted January 23, 2017 Author Share Posted January 23, 2017 4 minutes ago, CodyJ(L) said: noExit = {} addEvent("eventNoVehiclePlayers", true) function eventNoVehiclePlayers() for eventPlayers in pairs(WrapedPlayers) do noExit[eventPlayers] = true exports.SAEGcommands:sendMessage(getPlayerName(client).." Has removed yeah ability to exit vehicle !", 255, 0, 0,eventPlayers) end end addEventHandler("eventNoVehiclePlayers", root, eventNoVehiclePlayers ) function noExitAye(player) if noExit[player] then cancelEvent() end end addEventHandler("onVehicleStartExit", getRootElement(), noExitAye) Yeah this is it, thx, going to try it 15 minutes ago, CodyJ(L) said: noExit = {} addEvent("eventNoVehiclePlayers", true) function eventNoVehiclePlayers() for eventPlayers in pairs(WrapedPlayers) do noExit[eventPlayers] = true exports.SAEGcommands:sendMessage(getPlayerName(client).." Has removed yeah ability to exit vehicle !", 255, 0, 0,eventPlayers) end end addEventHandler("eventNoVehiclePlayers", root, eventNoVehiclePlayers ) function noExitAye(player) if noExit[player] then cancelEvent() end end addEventHandler("onVehicleStartExit", getRootElement(), noExitAye) It shows up an error saying Table index is nil Link to comment
Gastonito Posted January 24, 2017 Author Share Posted January 24, 2017 18 hours ago, CodyJ(L) said: Which line? Line : noExit[eventPlayers] = true Link to comment
idarrr Posted January 24, 2017 Share Posted January 24, 2017 Maybe the WrapedPlayers is the problem, the eventPlayers is nil. Link to comment
Gastonito Posted January 24, 2017 Author Share Posted January 24, 2017 1 hour ago, idarrr said: Maybe the WrapedPlayers is the problem, the eventPlayers is nil. @idarrr and @CodyJ(L) i fixed that error, but the disabling of vehicle leaving didnt work, it outpouts the message but still i can get out of my car, any suggestions ? :v Link to comment
Gastonito Posted January 25, 2017 Author Share Posted January 25, 2017 On 23/01/2017 at 21:41, CodyJ(L) said: noExit = {} addEvent("eventNoVehiclePlayers", true) function eventNoVehiclePlayers() for eventPlayers in pairs(WrapedPlayers) do noExit[eventPlayers] = true exports.SAEGcommands:sendMessage(getPlayerName(client).." Has removed yeah ability to exit vehicle !", 255, 0, 0,eventPlayers) end end addEventHandler("eventNoVehiclePlayers", root, eventNoVehiclePlayers ) function noExitAye(player) if noExit[player] then cancelEvent() end end addEventHandler("onVehicleStartExit", getRootElement(), noExitAye) @idarrr This is it :v Link to comment
Gastonito Posted January 27, 2017 Author Share Posted January 27, 2017 Hello ? Guys ? @CodyJ(L) ? @idarrr ? Anyone ? Link to comment
idarrr Posted January 28, 2017 Share Posted January 28, 2017 Where is WrapedPlayers table? Link to comment
Gastonito Posted January 28, 2017 Author Share Posted January 28, 2017 10 hours ago, idarrr said: Where is WrapedPlayers table? No, Thats not the problem. It got fixed by @Simple01 Final And FIXED Code : local noExit = {} addEvent("eventNoVehiclePlayers", true) function eventNoVehiclePlayers() local eventManager = getAccountName(getPlayerAccount(source)) if ( eventVehicles[eventManager] ) then for eventPlayer in pairs(WrapedPlayers) do noExit[ eventPlayer ] = true exports.SAEGcommands:sendMessage(getPlayerName(client).." Has removed your ability to exit vehicle !", 255, 0, 0,eventPlayers) end end end addEventHandler("eventNoVehiclePlayers", root, eventNoVehiclePlayers ) function noExitAye(player) if noExit[player] then cancelEvent() end end addEventHandler("onVehicleStartExit", root, noExitAye) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now