Best-Killer1 Posted September 25, 2015 Share Posted September 25, 2015 (edited) how i can make vehicle group system with colors ? not the marker but i want change color car of the group example SWAT Cars Blue (not the marker) Codes Server-Side : 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 {{"Military"}, 206.99, 1931.85, 22,0, 0, 255, 150, {487, 425, 520 }, 3, "Group"}, ---- LV HQ BASE AIRCRAFT ---SWAT {{"SWAT"}, 848.93, -2117.51, 1.95,0, 0, 255, 150, {411, 522, 544 }, 90, "Group"}, ----- LS HG Base Cars {{"SWAT"}, 825.98, -2087.69, 43.38,0, 0, 255, 150, {520, 519, 476 }, 1, "Group"}, ----- LS HG Base AirCraft {{"SWAT"}, 836.14, -2020.34, 13.11,0, 0, 255, 150, {411, 522, 544 }, 1, "Group"}, --------- LS HG Base Cars } 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) Edited September 25, 2015 by Guest Link to comment
BluntZ Posted September 25, 2015 Share Posted September 25, 2015 I told u dont fucking post/give my code to anyone , remove it Any admin , its my group spawners Link to comment
KariiiM Posted September 25, 2015 Share Posted September 25, 2015 I told u dont post/give my code to anyone , remove it Any admin , its my group spawners It's not your code or even his code ,why you lie?,This code is stolen from SAUR RPG already a code like it got removed by the owner of this code like a month ago or so , i don't think so you guys are allowed to use or edit them since the owner of those codes is still removing them! I can't find the topic similer to this because the code is removed ,but here's a code from saur old version posted by you and removed by the owner of it, you can see it HERE and there are alot. Read this TOPIC to know more about stolen resources. try to learn like that you'll never succes you will always need to get leaked scripts or done scripts to edit them! ~Good luck Link to comment
Moderators Citizen Posted September 25, 2015 Moderators Share Posted September 25, 2015 Also stealing codes or entire resources and then asking for help to fix/modify it is just a joke. I can't believe some of the community members are doing that, it's a shame. The solution to your question is obvious for all decent scripters (no need to be a Lua/MTA pro to know what to modify), and should be even more obvious for the one who really made this code. As your question shows it: You are not the one who made this script, neither a good scripter. It's time to do things by yourself and learn the basis of Lua/MTA. And you won't learn by posting 1 topic a day to ask for someone to do it for you. Link to comment
Best-Killer1 Posted September 25, 2015 Author Share Posted September 25, 2015 I told u dont post/give my code to anyone , remove it Any admin , its my group spawners It's not your code or even his code ,why you lie?,This code is stolen from SAUR RPG already a code like it got removed by the owner of this code like a month ago or so , i don't think so you guys are allowed to use or edit them since the owner of those codes is still removing them! I can't find the topic similer to this because the code is removed ,but here's a code from saur old version posted by you and removed by the owner of it, you can see it HERE and there are alot. Read this TOPIC to know more about stolen resources. try to learn like that you'll never succes you will always need to get leaked scripts or done scripts to edit them! ~Good luck lol bluntz gave me it i don't stole it Link to comment
Best-Killer1 Posted September 25, 2015 Author Share Posted September 25, 2015 So ? No help ? Link to comment
KariiiM Posted September 25, 2015 Share Posted September 25, 2015 So ? No help ? Exactly, no need to repeat the words Link to comment
Moderators Citizen Posted September 25, 2015 Moderators Share Posted September 25, 2015 lol bluntz gave me it i don't stole it Then why not asking bluntz to help you directly ? I won't help you aswell. Link to comment
Best-Killer1 Posted September 25, 2015 Author Share Posted September 25, 2015 lol bluntz gave me it i don't stole it Then why not asking bluntz to help you directly ? I won't help you aswell. he don't know anyway Thanx Guys Link to comment
Best-Killer1 Posted October 8, 2015 Author Share Posted October 8, 2015 setVehicleColor thanks you :* 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