Hello Community
Today I downloaded bridge-toll from community. Its awesome, I installed into my server it worked well, But I got a problem
when I hit any markers(modshops, carshops) while Im in car The Bridge-Toll Gui always shown. Help me
here is the script
-server side
-- Settings
local tollPrice = 150 -- Toll Price (Default: 150)
local allowedTypes = { ["Automobile"]=true; ["Bike"]=true; ["Monster Truck"]=true; } -- Allowed vehicle types
-- End of settings
-- Barriers
local tollbarrierLSLV = createObject (968, 1745.19, 509.79, 28.6, 0, 90, 340) -- gate LS > LV
local tollbarrierLSLV2 = createObject (968, 1736.8, 513.2, 28.6, 0, 89, 338) -- gate LS > LV 2
local tollbarrierLVLS = createObject (968, 1723.5, 510.5, 28.9, 0, 270, 338) -- gate LV > LS
local tollbarrierLVLS2 = createObject (968, 1731.9, 507.64, 28.9, 0, 271, 338) -- gate LV > LS 2
local tollbarrierLVSF = createObject (968, -1401.1, 826.2, 47.6, 0, 270, 318) -- gate LV > SF
local tollbarrierLVSF2 = createObject (968, -1407.9, 832, 47.6, 0, 270, 316) -- gate LV > SF 2
local tollbarrierSFLV = createObject (968, -1395.1, 829.2, 47.6, 0, 90, 316) -- gate SF > LV
local tollbarrierSFLV2 = createObject (968, -1389, 823.4, 47.6, 0, 90, 316) -- gate SF > LV 2
local tollbarrierTRSF = createObject (968, -2691.69, 1271.3, 55.5, 0, 270, 0) -- gate TR > SF
local tollbarrierTRSF2 = createObject (968, -2683, 1271.19, 55.5, 0, 270, 0) -- gate TR > SF 2
local tollbarrierSFTR = createObject (968, -2671.2, 1277.7, 55.5, 0, 90, 0) -- gate SF > TR
local tollbarrierSFTR2 = createObject (968, -2680.8, 1278.19, 55.5, 0, 90, 0) -- gate SF > TR 2
local tollbarrierLSSF = createObject (968, 51.7, -1528.1, 5.2, 0, 90, 85) -- gate LS > SF
local tollbarrierSFLS = createObject (968, 53.7, -1535, 5.2, 0, 270, 85) -- gate SF > LS
-- Blips
local tollblip1 = createBlip (1736, 512, 28, 42)
setBlipVisibleDistance (tollblip1, 250)
local tollblip2 = createBlip (-1398, 828, 53, 42)
setBlipVisibleDistance (tollblip2, 250)
local tollblip3 = createBlip (-2676, 1278, 62, 42)
setBlipVisibleDistance (tollblip3, 250)
local tollblip4 = createBlip (52.7, -1531.6, 6, 42)
setBlipVisibleDistance (tollblip4, 250)
-- Markers
local tollboothLSLV = createMarker (1746, 499, 27.5, "cylinder", 5, 0, 255, 0, 0)
local tollboothLSLV2 = createMarker (1736.69, 503.2, 27.5, "cylinder", 5.0, 0, 255, 0, 0)
local tollboothLVLS = createMarker (1725, 524, 27.5, "cylinder", 5, 0, 255, 0, 0)
local tollboothLVLS2 = createMarker (1732.19, 518.2, 27.1, "cylinder", 5.0, 0, 255, 0, 0)
local tollboothLVSF = createMarker (-1397, 836, 47, "cylinder", 5, 0, 0, 100, 0)
local tollboothLVSF2 = createMarker (-1403.59, 839.79, 46, "cylinder", 4.0, 0, 255, 0, 0)
local tollboothSFLV = createMarker (-1399, 820, 47, "cylinder", 5, 0, 255, 0, 0)
local tollboothSFLV2 = createMarker (-1394.09, 813.7, 46, "cylinder", 4.0,255, 0, 0, 0)
local tollboothTRSF = createMarker (-2696, 1283, 54, "cylinder", 5, 0, 255, 0, 0)
local tollboothTRSF2 = createMarker (-2686.3, 1281.8, 54, "cylinder", 5, 0, 255, 0, 0)
local tollboothSFTR = createMarker (-2667, 1268, 54, "cylinder", 5, 0, 255, 2, 0)
local tollboothSFTR2 = createMarker (-2677, 1267.3, 54, "cylinder", 5, 0, 255, 0, 0)
local tollboothLSSF = createMarker (57.59, -1525.3, 4, "cylinder", 5, 0, 255, 0, 0)
local tollboothSFLS = createMarker (46.79, -1537.09, 4, "cylinder", 5, 0, 255, 0, 0)
addEventHandler ("onMarkerHit", root,
function (hitElement, dimension)
if source == tollboothLSLV or tollboothLVLS or tollboothLVSF or tollboothSFLV or tollboothTRSF or tollboothSFTR or tollboothLSLV2 or tollboothLVLS2 or tollboothLVSF2 or tollboothSFLV2 or tollboothTRSF2 or tollboothSFTR2 or tollboothLSSF or tollboothSFLS and dimension then
if getElementType (hitElement) == "player" and isPedInVehicle (hitElement) then
local sourceVehicle = getPedOccupiedVehicle (hitElement)
local controller = getVehicleController (sourceVehicle)
local pAcc = getPlayerAccount (hitElement)
if allowedTypes [getVehicleType (sourceVehicle)] then
if isGuestAccount (pAcc) then
if getPlayerMoney (hitElement) < tollPrice then
outputChatBox ("[TOLL] You don't have enough money. (Toll Price: $"..tollPrice..")", controller, 255, 0, 0)
else
setElementVelocity (sourceVehicle, 0, 0, 0)
triggerClientEvent (controller, "manageTollGUI", controller, 1, tollPrice, true)
end
elseif not isGuestAccount (pAcc) then
if getAccountData (pAcc, "toll.impulses") and getAccountData (pAcc, "toll.impulses") > 0 then
setAccountData (pAcc, "toll.impulses", getAccountData (pAcc, "toll.impulses") - 1)
triggerEvent ("tollPaid", controller, true)
outputChatBox ("[TOLL] Toll impulse used, left:#ffffff "..getAccountData (pAcc, "toll.impulses"), controller, 255, 120, 0, true)
elseif not getAccountData (pAcc, "toll.impulses") or getAccountData (pAcc, "toll.impulses") == 0 then
setElementVelocity (sourceVehicle, 0, 0, 0)
triggerClientEvent (controller, "manageTollGUI", controller, 1, tollPrice)
end
end
else
outputChatBox ("[TOLL] This vehicle type is not allowed", controller, 255, 0, 0)
end
else
return
end
end
end
)
addEventHandler ("onMarkerLeave", root,
function (leaveElement)
if source == tollboothLSLV or tollboothLVLS or tollboothLVSF or tollboothSFLV or tollboothTRSF or tollboothSFTR or tollboothLSLV2 or tollboothLVLS2 or tollboothLVSF2 or tollboothSFLV2 or tollboothTRSF2 or tollboothSFTR2 then
if getElementType (leaveElement) == "player" and isPedInVehicle (leaveElement) then
triggerClientEvent (leaveElement, "manageTollGUI", leaveElement, 2)
end
end
end
)
-Client side
-- Settings
local enableImpulses = true -- If set to false players will not be able to purchase impulses
-- End of settings
function centerTollGUI (theWindow)
local screenW, screenH = guiGetScreenSize ()
local windowW, windowH = guiGetSize (theWindow,false)
local x, y = (screenW - windowW) / 2, (screenH - windowH) / 2
guiSetPosition (theWindow, x, y, false)
end
-- Toll GUI
local tollGUI = guiCreateWindow(0.37, 0.22, 0.34, 0.41,"Toll Booth",true)
centerTollGUI (tollGUI)
guiWindowSetMovable(tollGUI,false)
guiWindowSetSizable(tollGUI,false)
guiSetVisible (tollGUI, false)
local tollIMG = guiCreateStaticImage(0.27, 0.07, 0.48, 0.47,"tollbooth.png",true,tollGUI)
local tollinfo = guiCreateLabel(0.34, 0.58, 0.42, 0.04,"Toll Price: $",true,tollGUI)
local tollinfoPrice = guiCreateLabel(0.53, 0.58, 0.42, 0.04,"",true,tollGUI)
local tollPay = guiCreateButton(0.17, 0.66, 0.64, 0.14,"Pay Toll",true,tollGUI)
local tollImpulses = guiCreateButton(0.17, 0.82, 0.64, 0.14,"Purchase Impulses",true,tollGUI)
local tollClose = guiCreateButton(0.88, 0.08, 0.09, 0.09,"X",true,tollGUI)