Best-Killer1 Posted September 24, 2015 Share Posted September 24, 2015 the marker up idk why this ss : http://i.imgur.com/7rSyOKQ.jpg and this the code : local rootElement = getRootElement() local markers = {} local playerVehicles = {} local playerTrailers = {} local lawTeams = {["Law Enforcement"] = true, ["SWAT"] = true, ["Military"] = true, ["Staff"] = true} --teamName, posX, posY, posZ, R, G, B, Alpha, Vehicle IDs, Rotation, Element data name local vehiclesTable = { ----- MILITARY {{"king"}, 206.99, 1931.85, 22,0, 0, 255, 150, {487, 425, 520 }, 3, "Group"}, ---- LV HQ BASE AIRCRAFT ---SWAT {{"SWAT"}, 824.13, -2139.37, 1.79,0, 0, 255, 100, {520, }, 1, "Group"}, } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(vehiclesTable) do local marker = createMarker(tostring(v[2]), tostring(v[3]), tostring(v[4]), "cylinder", 2.5, tostring(v[5]), tostring(v[6]), tostring(v[7]), tostring(v[8]), rootElement) if marker then markers[marker] = {v[1], v[9], v[10], v[11], v[12]} addEventHandler("onMarkerHit", marker, onSpawnerMarkerHit) setElementData(marker,"teamMarker",true) end end end) function onSpawnerMarkerHit(hitPlayer, matchingDimension) if not matchingDimension then return end if getElementType(hitPlayer) == "player" then if isPedInVehicle(hitPlayer) then return end local markerTeam = getElementData(source,"teamMarker") if not markerTeam then return end local teamName = getElementData(hitPlayer,tostring(markers[source][4])) if not teamName then return end for i,v in pairs(markers[source][1]) do if v == teamName then triggerClientEvent(hitPlayer,"show_vehicle_selector",hitPlayer,markers[source][2],source) end end end end addEvent("vehicle_spawn",true) addEventHandler("vehicle_spawn",rootElement, function (player, vehicleID, marker) if isElement(playerVehicles[player]) then destroyElement(playerVehicles[player]) end if isElement(playerTrailers[player]) then destroyElement(playerTrailers[player]) end local x, y, z = getElementPosition(marker) playerVehicles[player] = createVehicle(vehicleID, x, y, z+3, 0, 0, markers[marker][3]) warpPedIntoVehicle(player, playerVehicles[player]) setElementData(playerVehicles[player],"allowedJobs",markers[marker][1]) setElementData(playerVehicles[player],"allowedData",markers[marker][4]) if markers[marker][5] then playerTrailers[player] = createVehicle(markers[marker][4], x-9, y, z + 3, 0, 0, markers[marker][3]) if playerTrailers[player] then setElementData(playerVehicles[player],"trailer",playerTrailers[player]) addEventHandler("onVehicleExplode",playerTrailers[player],function () if isElement(source) then destroyElement(source) end end) end end addEventHandler("onVehicleExplode",playerVehicles[player],function () if isElement(source) then if getElementData(source,"trailer") and isElement(getElementData(source,"trailer")) then destroyElement(getElementData(source,"trailer")) end destroyElement(source) end end) end) function vehicleEnterCheck(player, seat, jacked) if (seat ~= 0) then return end local allowedJobs = getElementData(source, "allowedJobs") if not allowedJobs or not type(allowedJobs) == "table" then return end local allowedData = getElementData(source, "allowedData") local teamName = getElementData(player, tostring(allowedData)) if not teamName then return end local tempTable = {} for index, Job in ipairs(allowedJobs) do tempTable[Job] = true end local driver = getVehicleController(source) local wanted = 0 if (driver) then wanted = getPlayerWantedLevel(driver) end if (tempTable[teamName] or lawTeams[getTeamName(getPlayerTeam(player))] and wanted < 6) then return else cancelEvent() outputChatBox(player, "You cannot enter this vehicle.",255,100,0) end end addEventHandler("onVehicleStartEnter",root,vehicleEnterCheck) function onLogoutOrQuit() if isElement(playerVehicles[source]) then destroyElement(playerVehicles[source]) end if isElement(playerTrailers[source]) then destroyElement(playerTrailers[source]) end end addEventHandler("onPlayerLogout",root,onLogoutOrQuit) addEventHandler("onPlayerQuit",root,onLogoutOrQuit) Link to comment
KariiiM Posted September 24, 2015 Share Posted September 24, 2015 local rootElement = getRootElement() local markers = {} local playerVehicles = {} local playerTrailers = {} local lawTeams = {["Law Enforcement"] = true, ["SWAT"] = true, ["Military"] = true, ["Staff"] = true} --teamName, posX, posY, posZ, R, G, B, Alpha, Vehicle IDs, Rotation, Element data name local vehiclesTable = { ----- MILITARY {{"king"}, 206.99, 1931.85, 22,0, 0, 255, 150, {487, 425, 520 }, 3, "Group"}, ---- LV HQ BASE AIRCRAFT ---SWAT {{"SWAT"}, 824.13, -2139.37, 1.79,0, 0, 255, 100, {520, }, 1, "Group"}, } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(vehiclesTable) do local marker = createMarker(tostring(v[2]), tostring(v[3]), tostring(v[4])-1, "cylinder", 2.5, tostring(v[5]), tostring(v[6]), tostring(v[7]), tostring(v[8]), rootElement) if marker then markers[marker] = {v[1], v[9], v[10], v[11], v[12]} addEventHandler("onMarkerHit", marker, onSpawnerMarkerHit) setElementData(marker,"teamMarker",true) end end end) function onSpawnerMarkerHit(hitPlayer, matchingDimension) if not matchingDimension then return end if getElementType(hitPlayer) == "player" then if isPedInVehicle(hitPlayer) then return end local markerTeam = getElementData(source,"teamMarker") if not markerTeam then return end local teamName = getElementData(hitPlayer,tostring(markers[source][4])) if not teamName then return end for i,v in pairs(markers[source][1]) do if v == teamName then triggerClientEvent(hitPlayer,"show_vehicle_selector",hitPlayer,markers[source][2],source) end end end end addEvent("vehicle_spawn",true) addEventHandler("vehicle_spawn",rootElement, function (player, vehicleID, marker) if isElement(playerVehicles[player]) then destroyElement(playerVehicles[player]) end if isElement(playerTrailers[player]) then destroyElement(playerTrailers[player]) end local x, y, z = getElementPosition(marker) playerVehicles[player] = createVehicle(vehicleID, x, y, z+3, 0, 0, markers[marker][3]) warpPedIntoVehicle(player, playerVehicles[player]) setElementData(playerVehicles[player],"allowedJobs",markers[marker][1]) setElementData(playerVehicles[player],"allowedData",markers[marker][4]) if markers[marker][5] then playerTrailers[player] = createVehicle(markers[marker][4], x-9, y, z + 3, 0, 0, markers[marker][3]) if playerTrailers[player] then setElementData(playerVehicles[player],"trailer",playerTrailers[player]) addEventHandler("onVehicleExplode",playerTrailers[player],function () if isElement(source) then destroyElement(source) end end) end end addEventHandler("onVehicleExplode",playerVehicles[player],function () if isElement(source) then if getElementData(source,"trailer") and isElement(getElementData(source,"trailer")) then destroyElement(getElementData(source,"trailer")) end destroyElement(source) end end) end) function vehicleEnterCheck(player, seat, jacked) if (seat ~= 0) then return end local allowedJobs = getElementData(source, "allowedJobs") if not allowedJobs or not type(allowedJobs) == "table" then return end local allowedData = getElementData(source, "allowedData") local teamName = getElementData(player, tostring(allowedData)) if not teamName then return end local tempTable = {} for index, Job in ipairs(allowedJobs) do tempTable[Job] = true end local driver = getVehicleController(source) local wanted = 0 if (driver) then wanted = getPlayerWantedLevel(driver) end if (tempTable[teamName] or lawTeams[getTeamName(getPlayerTeam(player))] and wanted < 6) then return else cancelEvent() outputChatBox(player, "You cannot enter this vehicle.",255,100,0) end end addEventHandler("onVehicleStartEnter",root,vehicleEnterCheck) function onLogoutOrQuit() if isElement(playerVehicles[source]) then destroyElement(playerVehicles[source]) end if isElement(playerTrailers[source]) then destroyElement(playerTrailers[source]) end end addEventHandler("onPlayerLogout",root,onLogoutOrQuit) addEventHandler("onPlayerQuit",root,onLogoutOrQuit) Link to comment
Best-Killer1 Posted September 24, 2015 Author Share Posted September 24, 2015 local rootElement = getRootElement() local markers = {} local playerVehicles = {} local playerTrailers = {} local lawTeams = {["Law Enforcement"] = true, ["SWAT"] = true, ["Military"] = true, ["Staff"] = true} --teamName, posX, posY, posZ, R, G, B, Alpha, Vehicle IDs, Rotation, Element data name local vehiclesTable = { ----- MILITARY {{"king"}, 206.99, 1931.85, 22,0, 0, 255, 150, {487, 425, 520 }, 3, "Group"}, ---- LV HQ BASE AIRCRAFT ---SWAT {{"SWAT"}, 824.13, -2139.37, 1.79,0, 0, 255, 100, {520, }, 1, "Group"}, } addEventHandler("onResourceStart", resourceRoot, function () for i,v in pairs(vehiclesTable) do local marker = createMarker(tostring(v[2]), tostring(v[3]), tostring(v[4])-1, "cylinder", 2.5, tostring(v[5]), tostring(v[6]), tostring(v[7]), tostring(v[8]), rootElement) if marker then markers[marker] = {v[1], v[9], v[10], v[11], v[12]} addEventHandler("onMarkerHit", marker, onSpawnerMarkerHit) setElementData(marker,"teamMarker",true) end end end) function onSpawnerMarkerHit(hitPlayer, matchingDimension) if not matchingDimension then return end if getElementType(hitPlayer) == "player" then if isPedInVehicle(hitPlayer) then return end local markerTeam = getElementData(source,"teamMarker") if not markerTeam then return end local teamName = getElementData(hitPlayer,tostring(markers[source][4])) if not teamName then return end for i,v in pairs(markers[source][1]) do if v == teamName then triggerClientEvent(hitPlayer,"show_vehicle_selector",hitPlayer,markers[source][2],source) end end end end addEvent("vehicle_spawn",true) addEventHandler("vehicle_spawn",rootElement, function (player, vehicleID, marker) if isElement(playerVehicles[player]) then destroyElement(playerVehicles[player]) end if isElement(playerTrailers[player]) then destroyElement(playerTrailers[player]) end local x, y, z = getElementPosition(marker) playerVehicles[player] = createVehicle(vehicleID, x, y, z+3, 0, 0, markers[marker][3]) warpPedIntoVehicle(player, playerVehicles[player]) setElementData(playerVehicles[player],"allowedJobs",markers[marker][1]) setElementData(playerVehicles[player],"allowedData",markers[marker][4]) if markers[marker][5] then playerTrailers[player] = createVehicle(markers[marker][4], x-9, y, z + 3, 0, 0, markers[marker][3]) if playerTrailers[player] then setElementData(playerVehicles[player],"trailer",playerTrailers[player]) addEventHandler("onVehicleExplode",playerTrailers[player],function () if isElement(source) then destroyElement(source) end end) end end addEventHandler("onVehicleExplode",playerVehicles[player],function () if isElement(source) then if getElementData(source,"trailer") and isElement(getElementData(source,"trailer")) then destroyElement(getElementData(source,"trailer")) end destroyElement(source) end end) end) function vehicleEnterCheck(player, seat, jacked) if (seat ~= 0) then return end local allowedJobs = getElementData(source, "allowedJobs") if not allowedJobs or not type(allowedJobs) == "table" then return end local allowedData = getElementData(source, "allowedData") local teamName = getElementData(player, tostring(allowedData)) if not teamName then return end local tempTable = {} for index, Job in ipairs(allowedJobs) do tempTable[Job] = true end local driver = getVehicleController(source) local wanted = 0 if (driver) then wanted = getPlayerWantedLevel(driver) end if (tempTable[teamName] or lawTeams[getTeamName(getPlayerTeam(player))] and wanted < 6) then return else cancelEvent() outputChatBox(player, "You cannot enter this vehicle.",255,100,0) end end addEventHandler("onVehicleStartEnter",root,vehicleEnterCheck) function onLogoutOrQuit() if isElement(playerVehicles[source]) then destroyElement(playerVehicles[source]) end if isElement(playerTrailers[source]) then destroyElement(playerTrailers[source]) end end addEventHandler("onPlayerLogout",root,onLogoutOrQuit) addEventHandler("onPlayerQuit",root,onLogoutOrQuit) Thanx Link to comment
KariiiM Posted September 24, 2015 Share Posted September 24, 2015 Thanx You're welcome. 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