Mσнαмα∂ Hєℓιѕн Posted August 16, 2018 Share Posted August 16, 2018 hi guys i have a problem for vehicle factions! local policeVehicles = { {597, 1645.125, -1367.453125, 17.443872451782}, {597, 1641.125, -1367.453125, 17.443872451782}, {597, 1637.125, -1367.453125, 17.443872451782}, {597, 1633.125, -1367.453125, 17.443872451782}, {597, 1629.125, -1367.453125, 17.443872451782}, {597, 1625.125, -1367.453125, 17.443872451782}, {447, 1680.181640625, -1418.8740234375, 85.044067382813}, {447, 1680.181640625, -1400.8740234375, 85.044067382813}, {447, 1680.181640625, -1382.8740234375, 85.044067382813}, } local police = "Police" addEventHandler("onResourceStart",resourceRoot,function() for _, v in ipairs(policeVehicles) do local veh = createVehicle(v[1],v[2],v[3],v[4],0,0,v[5]) -- spawn a car setElementData(veh,"carFaction",police) -- set car's faction end end) function vh ( player, seat ) if seat == 0 then -- allow to sit only next to the driver if getElementData(source,"carFaction") == police then -- check car if getElementData(player,"faction") == police then -- check player cancelEvent() outputChatBox ( "#ffff00Shoma Dar Faction F.B.I Nistid!", player,240,155,15,true) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), vh ) what is this problem ? all players can enter Police Vehicle @JeViCo Link to comment
JeViCo Posted August 16, 2018 Share Posted August 16, 2018 (edited) script contains errors now i guess. You didn't add rotation of vehicles in policeVehicles table before }, replace createVehicle(v[1],v[2],v[3],v[4],0,0,v[5]) with createVehicle(v[1],v[2],v[3],v[4]) Edited August 16, 2018 by JeViCo Link to comment
Mσнαмα∂ Hєℓιѕн Posted August 16, 2018 Author Share Posted August 16, 2018 8 minutes ago, JeViCo said: script contains errors now i guess. You didn't add rotation of vehicles in policeVehicles table before }, replace createVehicle(v[1],v[2],v[3],v[4],0,0,v[5]) with createVehicle(v[1],v[2],v[3],v[4]) not working! Link to comment
JeViCo Posted August 16, 2018 Share Posted August 16, 2018 fixed i guess local policeVehicles = { {597, 1645.125, -1367.453125, 17.443872451782}, {597, 1641.125, -1367.453125, 17.443872451782}, {597, 1637.125, -1367.453125, 17.443872451782}, {597, 1633.125, -1367.453125, 17.443872451782}, {597, 1629.125, -1367.453125, 17.443872451782}, {597, 1625.125, -1367.453125, 17.443872451782}, {447, 1680.181640625, -1418.8740234375, 85.044067382813}, {447, 1680.181640625, -1400.8740234375, 85.044067382813}, {447, 1680.181640625, -1382.8740234375, 85.044067382813}, } local police = "Police" addEventHandler("onResourceStart",resourceRoot,function() for _, v in ipairs(policeVehicles) do local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car setElementData(veh,"carFaction",police) -- set car's faction end end) function vh ( player, seat ) if seat == 0 then -- allow to sit only next to the driver if getElementData(source,"carFaction") == police then -- check car if getElementData(player,"faction") ~= police then -- check player cancelEvent() outputChatBox ( "#ffff00Shoma Dar Faction F.B.I Nistid!", player,240,155,15,true) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), vh ) Link to comment
WorthlessCynomys Posted August 16, 2018 Share Posted August 16, 2018 Do you have debugscript on 3? Do you have any error messages? Link to comment
Mσнαмα∂ Hєℓιѕн Posted August 16, 2018 Author Share Posted August 16, 2018 9 minutes ago, JeViCo said: fixed i guess local policeVehicles = { {597, 1645.125, -1367.453125, 17.443872451782}, {597, 1641.125, -1367.453125, 17.443872451782}, {597, 1637.125, -1367.453125, 17.443872451782}, {597, 1633.125, -1367.453125, 17.443872451782}, {597, 1629.125, -1367.453125, 17.443872451782}, {597, 1625.125, -1367.453125, 17.443872451782}, {447, 1680.181640625, -1418.8740234375, 85.044067382813}, {447, 1680.181640625, -1400.8740234375, 85.044067382813}, {447, 1680.181640625, -1382.8740234375, 85.044067382813}, } local police = "Police" addEventHandler("onResourceStart",resourceRoot,function() for _, v in ipairs(policeVehicles) do local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car setElementData(veh,"carFaction",police) -- set car's faction end end) function vh ( player, seat ) if seat == 0 then -- allow to sit only next to the driver if getElementData(source,"carFaction") == police then -- check car if getElementData(player,"faction") ~= police then -- check player cancelEvent() outputChatBox ( "#ffff00Shoma Dar Faction F.B.I Nistid!", player,240,155,15,true) end end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), vh ) faction member Police can't enter vehicle Link to comment
WorthlessCynomys Posted August 16, 2018 Share Posted August 16, 2018 2 minutes ago, Mσнαмα∂ Hєℓιѕн said: faction member Police can't enter vehicle Do you set the element data of the member of the police faction? I mean I'm quite sure that element data is not the only thing determining whether someone is police or not. Link to comment
Mσнαмα∂ Hєℓιѕн Posted August 16, 2018 Author Share Posted August 16, 2018 (edited) 9 minutes ago, WorthlessCynomys said: Do you set the element data of the member of the police faction? I mean I'm quite sure that element data is not the only thing determining whether someone is police or not. I want to make only members of the police cops be able to board the policeVehicles! Edited August 16, 2018 by Mσнαмα∂ Hєℓιѕн Link to comment
WorthlessCynomys Posted August 16, 2018 Share Posted August 16, 2018 5 minutes ago, Mσнαмα∂ Hєℓιѕн said: I want to make only members of the police cops be able to board the policeVehicles! And that is decided by element data. Do you use debugscript? Have any errors? Who can enter the vehicle now? Police can't and everyone else can? Link to comment
Mσнαмα∂ Hєℓιѕн Posted August 16, 2018 Author Share Posted August 16, 2018 18 minutes ago, WorthlessCynomys said: And that is decided by element data. Do you use debugscript? Have any errors? Who can enter the vehicle now? Police can't and everyone else can? no body can enter Police Vehicles no i dont have any errors! Link to comment
WorthlessCynomys Posted August 16, 2018 Share Posted August 16, 2018 Do you have the line setElementData(player, "faction", "Police") Somewhere in your codes? In the function vh insert the line: outputChatBox(tostring(getElementData(player, "faction"))) and tell me what it outputs in the chatbox when you try to enter a police vehicle. Link to comment
JeViCo Posted August 17, 2018 Share Posted August 17, 2018 i checked and everying working. Something wrong with your faction name (replace "with F.B.I or rewrite script a little bit if you want to give access for several factions") OR You have a teams instead of elementData 1 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