ViperZz Posted April 23, 2020 Share Posted April 23, 2020 Salut! Astăzi am decis să apelez la forum fiindcă aici pot găsi rezolvarea. Doresc și eu să mă ajute cineva cu un script pentru că anumite mașini să nu poată fi accesate de playeri normali, doar de admini. Dacă mă poate ajuta cnv îl rog să îmi dea mesaj. Mulțumesc! Link to comment
Tekken Posted April 24, 2020 Share Posted April 24, 2020 Un script sincer n-am timp sa-l fac, insa te invit sa inverci, ai nevoie de Eventul : 'onPlayerVehicleEnter' Functii: isObjectInAclGroup Si daca te uiti pe wiki la isObjectInAclGroup ai un exemplu te poti Lua dupa el. Succes. Link to comment
Felix5k Posted April 24, 2020 Share Posted April 24, 2020 OnVehicleStartEnter si mai ai nevoie de un if care il citeste daca e admin simplu Link to comment
Hydra Posted April 25, 2020 Share Posted April 25, 2020 function adminVehicle() local car = getPedOccupiedVehicle(source) local accName = getPlayerAccount(source) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then outputChatBox("Acces allowed", source, 255, 255, 255, true) else if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then return cancelEvent() end end addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle) Incearca asta Link to comment
Hydra Posted April 26, 2020 Share Posted April 26, 2020 (edited) 12 hours ago, Hydra said: function adminVehicle() local car = getPedOccupiedVehicle(source) local accName = getPlayerAccount(source) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then outputChatBox("Acces allowed", source, 255, 255, 255, true) else if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then return cancelEvent() end end addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle) Incearca asta @ViperZz , modifica tot codu cu asta deoarece nu o sa iti mearga cu ,,source" function adminVehicle(thePlayer) local car = getPedOccupiedVehicle(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then outputChatBox("Acces allowed", thePlayer, 255, 255, 255, true) else if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then return cancelEvent() end end end addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle) Edited April 26, 2020 by Hydra Link to comment
ViperZz Posted April 26, 2020 Author Share Posted April 26, 2020 Multumesc mult Functioneaza! Dar cum as putea edita sa mearga pe mai multe masini? Link to comment
Tekken Posted April 26, 2020 Share Posted April 26, 2020 Cu placere local unallowedVeh = {422, 514, 674}; addEventHandler("onVehicleStartEnter", root, function(player) local model = getElementModel(source); for _,id in ipairs(unallowedVeh) do if (model == id) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then outputChatBox("You are not allowed to use this vehicle!", 255, 0, 0); cancelEvent(); end end end end); 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