Ayee Posted October 13, 2017 Share Posted October 13, 2017 كل حاجا شغله بس انا عاوز اخود لبشوغلنا ما بتشتغل This Code Jobs This Client Quote local client = getLocalPlayer() local rootElement = getRootElement() local marker local sx,sy = guiGetScreenSize() function getJobTable(player,bool) triggerServerEvent("getJobTable",player,player,bool) end job_window = guiCreateWindow(0.2803,0.1888,0.4121,0.4688,"",true) guiWindowSetSizable(job_window,false) guiSetVisible(job_window,false) job_desc = guiCreateMemo(0.09,0.0917,0.8341,0.7694,"",true,job_window) guiMemoSetReadOnly(job_desc,true) job_accept = guiCreateButton(0.1991,0.8861,0.2346,0.0694,"Accept",true,job_window) job_reject = guiCreateButton(0.5806,0.8861,0.2346,0.0694,"Close",true,job_window) addEvent("show_job_window",true) addEventHandler("show_job_window",rootElement, function (jobName, jobDescription, mkr) guiSetVisible(job_window,true) showCursor(true) guiSetText(job_window,tostring(jobName)) guiSetText(job_desc,tostring(jobDescription)) marker = mkr end) addEventHandler("onClientGUIClick",rootElement, function () if (source == job_reject) then guiSetVisible(job_window,false) showCursor(false) guiSetText(job_window,"") guiSetText(job_desc,"") elseif (source == job_accept) then triggerServerEvent("job_accept",client,client,marker) guiSetVisible(job_window,false) showCursor(false) guiSetText(job_window,"") guiSetText(job_desc,"") end end) addEventHandler("onClientRender",getRootElement(), function () for i,v in ipairs(getElementsByType("ped")) do if getElementData(v,"jobPed") then if getElementDimension(localPlayer) > 0 then return end local name = getElementData(v,"jobName") if ( not name ) then return end local x,y,z = getElementPosition(v) local cx,cy,cz = getCameraMatrix() if getDistanceBetweenPoints3D(cx,cy,cz,x,y,z) <= 15 then local px,py = getScreenFromWorldPosition(x,y,z+1.3,0.06) if px then local width = dxGetTextWidth(name,1,"sans") local r,g,b = unpack(getElementData(v,"jobColor")) dxDrawBorderedText(name, px, py, px, py, tocolor(r, g, b, 255), 2, "sans", "center", "center", false, false) end end end end end) function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end function getClientJob(client) return getElementData(client,"Role") end function onJobPedClick(button, state, absX, absY, wx, wy, wz, element) if element and getElementType(element) == "ped" and state=="down" and button=="right" then local x, y, z = getElementPosition(getLocalPlayer()) if getElementData(element,"jobPed") then if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then triggerServerEvent("onJobPedClicked",client,client,element) end end end end addEventHandler("onClientClick", getRootElement(), onJobPedClick, true) addEventHandler("onClientPedDamage",root, function () if getElementData(source,"jobPed") then cancelEvent() end end) This Server Quote local rootElement = getRootElement() local jobTable = {} local jobPeds = {} local plrBlips = {} local skipBlips = {} local antiCmdSpam = {} --teamName, red, green, blue local teamTable = { {"Staff", 122, 55, 139}, {"SWAT", 40, 60, 237}, {"Police", 28, 134, 238}, {"FBI", 183, 110, 121}, {"Emergency", 42, 255, 255}, {"Criminal", 238, 44, 44}, {"Civilian", 238, 238, 0}, {"Unemployed", 142, 142, 142}, {"Off Duty Workers", 255, 215, 0}, {"SAAF", 0, 159, 175}, {"Insurgents", 255, 122, 0}, } local callCommands = { ["mech"] = {"requests a mechanic in", "Mechanic"}, ["medic"] = {"requires a medic in", "Medic"}, ["swat"] = {"requires SWAT officer in", "SWAT officer"}, ["taxi"] = {"requires a taxi in", "Taxi Driver"}, } local staffTable = { ["Maxman"] = {"Owner", 217}, } --teamName, jobName, posX, posY, posZ, Description, Skin, Weapons, wanted level, rotation, r, g, b, hours local jobTable = { --Los Santos {team="Police", role="Police officer", x=251.25999, y=69.27944, z=1002.64063, desc="Police Cheif: We are looking to hire fresh meat like you. If you wish to continue on, accept this job offer and be on your way.Press F3 and read the police handbook as well. Failure to follow any rules will result in your immediate unemployment.", skin=280, weapons="3,1;", wl=0, rot=90, r=65, g=105, b=255, hours=4, arrests=0, int=6}, {team="Police", role="Police detective", x=251.25984, y=67.86244, z=1002.64063, desc="The Police Detective can investigate murders and find the killer by looking for clues in the crime scene. They also have the same powers as a regular police officer meaning they can perform arrests and use firearms.", skin=228, weapons="3,1;", wl=0, rot=90, r=65, g=105, b=255, hours=4, arrests=150, int=6}, {team="Criminal", role="Robber", x=2072.92, y=-1596.10, z=12.382, desc="To begin robbing a house, you'll need a vehicle. Once you have that drive to the house marked on your minimap and big map (press F11) once there park up and find the point of entry. What you find in the house to steal will vary in value, from nothing to a nice sum of money.", skin=28, weapons=";", wl=6, rot=45, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Hacker", x=954.61, y=-1553.95, z=12.58, desc="Hacker: Hacker description comming soon.", skin=210, weapons=";", wl=6, rot=-100, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Arms Dealer", x=2447.4221191406, y=-1980.2375488281, z=12.546875, desc="Arms Dealer: The arms dealer has to collect a crate of goods then sells the weapons on the streats to civilians. Use /sell to sell your stock", skin=29, weapons=";", wl=6, rot=0, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Drug Dealer", x=2165.18872, y=-1674.62439, z=14.08594, desc="Drug Dealer: The drug dealer has sell his drugs to other players. Use /sell to sell your stock.", skin=28, weapons=";", wl=6, rot=-100, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Car Jacker", x=1635.5206298828, y=-1520.8175048828, z=12.599546432495, desc="The Car Jacker is given a car to steal. But it isn't as easy as that, you need to beat all the other car jackers too it, and anybody else who may be driving it. Deliver it to one of the buyers locations for a nice sum of money.", skin=22, weapons=";", wl=6, rot=196, r=178, g=34, b=34, hours=0, arrests=0}, {team="Emergency", role="Medic", x=2042.7, y=-1411.37, z=16.25, desc="Medics are medically trained in giving emergency medical treatment. Medics can heal people through the use of their healing spray or healing passengers in their ambulance. Money is earned through healing people. \nJob Perk: Your player will heal slowly over time, and free health treatment.", skin=276, weapons="41,10000", wl=0, rot=90, r=72, g=209, b=204, hours=0, arrests=0}, {team="Emergency", role="Medic", x=1178.88, y=-1330.33, z=13.12, desc="Medics are medically trained in giving emergency medical treatment. Medics can heal people through the use of their healing spray or healing passengers in their ambulance. Money is earned through healing people. \n\nJob Perk: Your player will heal slowly over time, and free health treatment.", skin=276, weapons="41,10000", wl=0, rot=0, r=72, g=209, b=204, hours=0, arrests=0}, {team="Emergency", role="Fire Fighter", x=1754.7, y=-1459.37, z=12.5, desc="Firefighters repond to reports of fires breaking out across San Andreas. Be the first on the scene, put out the fire, and earn your wages.", skin=277, weapons="42,10000", wl=0, rot=0, r=238, g=118, b=0, hours=0, arrests=0}, {team="Civilian", role="Mechanic", x=1035.7, y=-1028.19, z=31.0, desc="A Mechanic can make money by performing repairs on any players vehicle. They can fully repair a vehicle. To repair a vehicle just stand still next to the vehicle and press m on your keyboard, then click the car. Wait for the person to respond and it wil repair.\n\nJob Perk: None", skin=50, weapons=";", wl=0, rot=180, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Bus Driver", x=1771.85, y=-1909.10, z=12.5, desc="Bus Drivers drive round Los Santos stopping at all the stops to collect passengers or money. ", skin=37, weapons=";", wl=0, rot=-90, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Taxi Driver", x=1673.85, y=-1133.10, z=22.9, desc="The taxi driver is a simple job. Get a taxi, find a customer, and take them where they want to go. This simple process makes you money, perhaps to progress onto something greater. \n\nJob Perk: Access to free taxis.", skin=142, weapons=";", wl=0, rot=0, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Pilot", x=2000.81, y=-2309.71, z=12.5, desc="The Pilot can fly people around San Andreas for a fee. Like a taxi driver but in a helicopter and it costs more. Not much more to say for now. \n\nJob Perk: Access to free helicopters.", skin=61, weapons=";", wl=0, rot=90, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Prostitute", x=1631.06, y=-1508.84, z=12.59, desc="prostitute makes money by being paid to have sex with clients. These clients can be asked if they want to have sex by getting into their vehicle as a passenger, if they want to pay your price then you will have sex with them, else you will be told they don't want to have sex.", skin=87, weapons=";", wl=0, rot=135, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Road Sweaper", x=2176, y=-2259, z=13.77, desc="The Waste Collector makes a living through collecting garbage. There are around 100 locations in the city where you can stop to pick up garbage. You can empty the garbage truck any time and you will receive a pay check based on the amount of garbage collected.", skin=260, weapons=";", wl=0, rot=225, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Hobo", x=1967.2095947266, y=-1175.5089794922, z=19.030742645264, desc="The Hobo does not have a job so has to make money through scavenging for money and food. You will randomly find money, food, or weapons. Some food may increase your health and some food may lower it. \n\nJob Perk: You can regain health with /sleep.", skin=78, weapons=";", wl=0, rot=180, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Trucker", x=163.06, y=-10.3809794922, z=0.57, desc="Trucker Job: Description comming Soon!", skin=202, weapons=";", wl=0, rot=-100, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Delivery Man", x=2281.7465820313, y=-2364.78515625, z=12.546875, desc="1. Get a delivery vehicle. \n\n2. Enter the marker at the delivery warehouse.\n\n3. Deliver the 5 Packages.\n\n4. Return to the warehouse for more work.", skin=20, weapons=";", wl=3, rot=-45, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Clubber", x=187.25, y=-1846.36, z=2.54, desc="The Clubber Role has no way of earing money. Its not really a job, But if you want to party! Be this job and get the right skin to DANCE!", skin=188, weapons=";", wl=3, rot=0, r=238, g=238, b=0, hours=0, arrests=0}, {team="SAAF", role="SAAF", x=2743.99365, y=-2451.27979, z=12.64844, desc="Take on the roll of an SAAF soldier. a man tasked with the protection of San Andreas in the ongoing battle between them and the Insurgents. Hunt down the insurgents in packs or hold the line with comrades at you back. you team will be your most valuable asset. Earn money and points by racking up kills. Each kill yields a bonus of $100 from the government. but beware. your death will result in the loss of valuable supplies worth $150. Reward points can be spent to purchase additional weapons in base and other goodies to help you in your endeavors. You are also assigned a rank based on your kill count. This means that your rank will increase after a certain amount of kills. Good luck soldiers! Use /scores to see all your statistics and the leaderboards", skin=121, weapons=";", wl=6, rot=0, r=0, g=159, b=175, hours=0, arrests=0}, {team="Insurgents", role="Insurgent", x=2746.83398, y=-2451.32080, z=12.6484, desc="Take on the roll of an Insurgent soldier. a man tasked with the destruction of the SAAF in the ongoing battle inside the warzone. Hunt down the SAAF soldiers in packs or hold the line with comrades at you back. you team will be your most valuable asset. Earn money and points by racking up kills. Each kill yields a bonus of $100 from the drug cartels. but beware. your death will result in the loss of valuable supplies worth $150. Reward points can be spent to purchase additional weapons in base and other goodies to help you in your endeavors. You are also assigned a rank based on your kill count. This means that your rank will increase after a certain amount of kills. Good luck soldiers! Use /scores to see all your statistics and the leaderboards", skin=121, weapons=";", wl=6, rot=0, r=255, g=122, b=0, hours=0, arrests=0}, {team="Civilian", role="Pizza Delivery", x=2106.6069335938, y=-1822.6779785156, z=12.557731628418, desc="The Pizza Delivery job is easy, you must get a delivery bike and deliver the pizzas when you get the assignment.", skin=155, weapons=";", wl=3, rot=179, r=238, g=238, b=0, hours=0, arrests=0}, --San Fierro {team="Police", role="Police officer", x=246.50602722168, y=120.39260101318, z=1002.2645874023, desc="Police Cheif: We are looking to hire fresh meat like you. If you wish to continue on, accept this job offer and be on your way.\n\nPress F3 and read the police handbook as well. Failure to follow any rules will result in your immediate unemployment.", skin=280, weapons="3,1;", wl=0, rot=178, r=65, g=105, b=255, hours=4, arrests=0, int=10}, {team="Police", role="Police detective", x=250.53419494629, y=120.3928527832, z=1002.21875, desc="The Police Detective can investigate murders and find the killer by looking for clues in the crime scene. They also have the same powers as a regular police officer meaning they can perform arrests and use firearms.", skin=228, weapons="3,1;", wl=0, rot=178, r=65, g=105, b=255, hours=4, arrests=150, int=10}, {team="Criminal", role="Robber", x=-2092.0549316406, y=297.1526184082, z=34.874198913574, desc="To begin robbing a house, you'll need a vehicle. Once you have that drive to the house marked on your minimap and big map (press F11) once there park up and find the point of entry. What you find in the house to steal will vary in value, from nothing to a nice sum of money.", skin=28, weapons=";", wl=6, rot=262, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Hacker", x=-2152.1281738281, y=-149.08529663086, z=35.49040222168, desc="Hacker: Hacker description comming soon.", skin=210, weapons=";", wl=6, rot=309, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Arms Dealer", x=-2455.2260742188, y=-135.91944885254, z=25.155265808105, desc="Arms Dealer: The arms dealer has to collect a crate of goods then sells the weapons on the streats to civilians. Use /sell to sell your stock", skin=29, weapons=";", wl=6, rot=91, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Drug Dealer", x=-1766.2380371094, y=498.81506347656, z=28.287027359009, desc="Drug Dealer: The drug dealer has sell his drugs to other players. Use /sell to sell your stock.", skin=28, weapons=";", wl=6, rot=344, r=178, g=34, b=34, hours=0, arrests=0}, {team="Criminal", role="Car Jacker", x=-2161.181640625, y=660.79382324219, z=51.440727233887, desc="The Car Jacker is given a car to steal. But it isn't as easy as that, you need to beat all the other car jackers too it, and anybody else who may be driving it. Deliver it to one of the buyers locations for a nice sum of money.", skin=22, weapons=";", wl=6, rot=240, r=178, g=34, b=34, hours=0, arrests=0}, {team="Emergency", role="Medic", x=-2655.0241699219, y=640.02557373047, z=13.454549789429, desc="Medics are medically trained in giving emergency medical treatment. Medics can heal people through the use of their healing spray or healing passengers in their ambulance. Money is earned through healing people. \n\nJob Perk: Your player will heal slowly over time, and free health treatment.", skin=276, weapons="41,10000", wl=0, rot=181, r=72, g=209, b=204, hours=0, arrests=0}, {team="Emergency", role="Fire Fighter", x=-2026.1965332031, y=67.168182373047, z=27.691593170166, desc="Firefighters repond to reports of fires breaking out across San Andreas. Be the first on the scene, put out the fire, and earn your wages.", skin=277, weapons="42,10000", wl=0, rot=270, r=238, g=118, b=0, hours=0, arrests=0}, {team="Civilian", role="Mechanic", x=-2034.6357421875, y=148.42826843262, z=27.8359375, desc="A Mechanic can make money by performing repairs on any players vehicle. They can fully repair a vehicle. To repair a vehicle just stand still next to the vehicle and press m on your keyboard, then click the car. Wait for the person to respond and it wil repair.\n\nJob Perk: None", skin=50, weapons=";", wl=0, rot=270, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Bus Driver", x=-1981.0186767578, y=167.43238830566, z=26.6875, desc="Bus Drivers drive round Los Santos stopping at all the stops to collect passengers or money. ", skin=37, weapons=";", wl=0, rot=83, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Taxi Driver", x=-1943.0610351563, y=571.796875, z=34.315952301025 , desc="The taxi driver is a simple job. Get a taxi, find a customer, and take them where they want to go. This simple process makes you money, perhaps to progress onto something greater. \n\nJob Perk: Access to free taxis.", skin=142, weapons=";", wl=0, rot=348, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Pilot", x=-1263.1885986328, y=40.952896118164, z=13.139158248901, desc="The Pilot can fly people around San Andreas for a fee. Like a taxi driver but in a helicopter and it costs more. Not much more to say for now. \n\nJob Perk: Access to free helicopters.", skin=61, weapons=";", wl=0, rot=221, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Prostitute", x=-2624.4897460938, y=1412.5024414063, z=6.09375, desc="prostitute makes money by being paid to have sex with clients. These clients can be asked if they want to have sex by getting into their vehicle as a passenger, if they want to pay your price then you will have sex with them, else you will be told they don't want to have sex.", skin=87, weapons=";", wl=0, rot=197, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Road Sweaper", x=-1625.0554199219, y=1291.130859375, z=6.1834831237793 , desc="The Waste Collector makes a living through collecting garbage. There are around 100 locations in the city where you can stop to pick up garbage. You can empty the garbage truck any time and you will receive a pay check based on the amount of garbage collected.", skin=260, weapons=";", wl=0, rot=101, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Hobo", x=-2016.5189208984, y=1109.3885498047, z=52.2890625, desc="The Hobo does not have a job so has to make money through scavenging for money and food. You will randomly find money, food, or weapons. Some food may increase your health and some food may lower it. \n\nJob Perk: You can regain health with /sleep.", skin=78, weapons=";", wl=0, rot=231, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Trucker", x=-2281.6997070313, y=2288.3559570313, z=3.970645904541, desc="Trucker Job: Description comming Soon!", skin=202, weapons=";", wl=0, rot=275, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Delivery Man", x=-1816.0390625, y=-174.32479858398, z=8.3984375, desc="1. Get a delivery vehicle. \n\n2. Enter the marker at the delivery warehouse.\n\n3. Deliver the 5 Packages.\n\n4. Return to the warehouse for more work.", skin=20, weapons=";", wl=3, rot=89, r=238, g=238, b=0, hours=0, arrests=0}, {team="Civilian", role="Pizza Delivery", x=-2331.6687011719, y=-164.5546875, z=34.5546875, desc="The Pizza Delivery job is easy, you must get a delivery bike and deliver the pizzas when you get the assignment.", skin=155, weapons=";", wl=3, rot=272, r=238, g=238, b=0, hours=0, arrests=0}, } function getJobsTable(client,bool) if bool then triggerClientEvent(client,"returnJobsTable",client,jobTable) end return jobTable end addEvent("getJobTable",true) addEventHandler("getJobTable",root,getJobsTable) addEventHandler("onResourceStop", resourceRoot, function () for i,v in pairs(getElementsByType("player")) do if (getPlayerTeam(v)) then local team = getTeamName(getPlayerTeam(v)) setElementData(v,"tempTeam",tostring(team)) end triggerClientEvent(v,"returnJobsTable",v,jobTable) end end) addEventHandler("onResourceStart", resourceRoot, function () for index, team in pairs(teamTable) do createTeam(tostring(team[1]), tonumber(team[2]), tonumber(team[3]), tonumber(team[4])) end for i,v in pairs(jobTable) do local ped = createPed(tonumber(v.skin), tostring(v.x), tostring(v.y), tostring(v.z)+1) if ped then setPedRotation(ped, tonumber(v.rot)) jobPeds[ped] = {v.team, v.role, v.weapons, v.desc, v.skin, v.wl, v.hours, v.arrests} setElementData(ped,"jobPed",true) setElementData(ped,"jobName",v.role) setElementData(ped,"jobColor",{v.r, v.g, v.b}) setElementFrozen(ped, true) if v.int then setElementInterior(ped, tonumber(v.int)) end end end for i,v in pairs(getElementsByType("player")) do local accData = getElementData(v,"tempTeam") if accData then setTimer(setPlayerTeam,2000,1,v,getTeamFromName(accData)) end local r, g, b = getPlayerNametagColor(v) plrBlips[v] = createBlipAttachedTo(v,0,2,r,g,b,255,0,1500) end for commandName,_ in pairs(callCommands) do addCommandHandler(tostring(commandName),onJobCommandCalled) end end) function onJobPedClick(hitPlayer, thePed) if isPedInVehicle(hitPlayer) then return end if getElementData(thePed,"jobName") == getPlayerJob(hitPlayer) then exports["(SAUR)Info"]:sendMessage(hitPlayer, "Job: Your job is already this.",255,0,0) return end local maxWanted = jobPeds[thePed][6] local hoursRequired = jobPeds[thePed][7] local maxArrests = jobPeds[thePed][8] local arrests = exports["(SAUR)PoliceDatabase"]:getPlayerArrests(hitPlayer) or 0 if hoursRequired > tonumber(getElementData(hitPlayer,"OnlineTime.hours")) then exports["(SAUR)Info"]:sendMessage(hitPlayer, "Job: This job requires that you have at least ".. tostring(hoursRequired) .." hours of gameplay.",255,0,0) return end local wanted = exports["(SAUR)PoliceDatabase"]:getPlayerWanted(hitPlayer) or 0 if maxArrests >= arrests and maxArrests > 0 then exports["(SAUR)Info"]:sendMessage(hitPlayer,"This job requires that you have more than ".. tostring(maxArrests) .." arrests.", 255, 0, 0) return end if wanted <= maxWanted then triggerClientEvent(hitPlayer,"show_job_window",hitPlayer,jobPeds[thePed][2],jobPeds[thePed][4],thePed) else exports["(SAUR)Info"]:sendMessage(hitPlayer,"This job requires that you have no more than ".. tostring(maxWanted) .." wanted stars.", 255, 0, 0) end end addEvent("onJobPedClicked",true) addEventHandler("onJobPedClicked",root,onJobPedClick) addEvent("job_accept",true) addEventHandler("job_accept",rootElement, function (client, marker) if not client then return end setPlayerTeam(client, getTeamFromName(tostring(jobPeds[marker][1]))) setElementData(client, "Role", tostring(jobPeds[marker][2])) exports["(SAUR)Info"]:sendMessage(client, "Job: You are now employed as ".. tostring(jobPeds[marker][2]) .."!",255,255,0) giveJobWeapons(client, tostring(jobPeds[marker][3])) local acc = getPlayerAccount(client) if acc and not isGuestAccount(acc) then setAccountData(acc,"job",tostring(jobPeds[marker][2])) setAccountData(acc,"jobSkin",tostring(jobPeds[marker][5])) if not getAccountData(acc,"tempSkin") then setAccountData(acc,"tempSkin",tostring(getElementModel(client))) end end triggerEvent("onPlayerGetJob",client,client,tostring(jobPeds[marker][1]),tostring(jobPeds[marker][2])) setTimer(setElementModel,2000,1,client, tonumber(jobPeds[marker][5])) end) function giveJobWeapons(player, weaponsString) local weaponPairs = split(weaponsString,string.byte(';')) local weapons = {} for i,pair in ipairs(weaponPairs) do weapons[i] = split(pair,string.byte(',')) if weapons[i] then if weapons[i][1] and weapons[i][2] then giveWeapon(source,weapons[i][1],weapons[i][2]) end end end end function getPlayersByJob(job) local jobPlayers = {} for index, player in pairs(getElementsByType("player")) do if getPlayerJob(player) == tostring(job) then table.insert(jobPlayers, player) end end return jobPlayers end function getPlayerJob(player) return getElementData(player,"Role") end function isPlayerOnDuty(player) local team = getPlayerTeam(player) if not team then return end local teamName = getTeamName(team) if teamName == "Unemployed" or teamName == "Off Duty Workers" then return false else return true end end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local job = getAccountData(account,"job") if job then setElementData(source,"Role",tostring(job)) else setElementData(source,"Role","None") end end end) function makeBlip() local r, g, b = getPlayerNametagColor(source) plrBlips[source] = createBlipAttachedTo(source,0,2,r,g,b,255,0,1500) end addEventHandler("onPlayerLogin",root,makeBlip) function destroyBlip() if plrBlips[source] and isElement(plrBlips[source]) then destroyElement(plrBlips[source]) plrBlips[source] = nil end end addEventHandler("onPlayerQuit",getRootElement(),destroyBlip) addEventHandler("onPlayerLogout",getRootElement(),destroyBlip) function updatePlayerBlips() for index, player in pairs(getElementsByType("player")) do if getPlayerAccount(player) and isGuestAccount(getPlayerAccount(player)) then return end local blip = plrBlips[player] local r,g,b = getPlayerNametagColor(player) if not blip and not skipBlips[player] then plrBlips[player] = createBlipAttachedTo(player,0,2,r,g,b,255,0,1500) end if blip then if not setBlipColor(blip,r,g,b,255) then setBlipColor(blip,r,g,b,255) end end end end setTimer(updatePlayerBlips,2500,0) addCommandHandler("duty", function (player) local account = getPlayerAccount(player) if account or not isGuestAccount(player) then if staffTable[getAccountName(account)] then setPlayerTeam(player, getTeamFromName("Staff")) setPlayerJob(player, staffTable[getAccountName(account)][1]) setAccountData(account,"WWRPG.playerTeam","Staff") setAccountData(account,"job",staffTable[getAccountName(account)][1]) setAccountData(account,"jobSkin",tonumber(staffTable[getAccountName(account)][2])) if not getAccountData(account,"tempSkin") then setAccountData(account,"tempSkin",tostring(getElementModel(player))) end setTimer(setElementModel,2000,1,player,tonumber(staffTable[getAccountName(account)][2])) end end end) addCommandHandler("ann", function (thePlayer, cmd, ...) local account = getPlayerAccount(thePlayer) if not account or isGuestAccount(account) then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup("Admin")) then local text = table.concat({...}," ") for i,v in pairs(getElementsByType("player")) do exports["(SAUR)Info"]:sendMessage(v,"Admin (".. getPlayerName(thePlayer) .."): ".. tostring(text), 0, 255, 0) end end end) function setPlayerJob(player, jobName) if player and jobName then setElementData(player,"Role",tostring(jobName)) end end local auth = {} function clanProtect(old,new) local name = new or getPlayerName(source) if string.find(name,"(SAUR)",1,true) or string.find(name,"[SAUR]",1,true) or string.find(name,"*SAUR*",1,true) then if not auth[source] then auth[source] = setTimer(checkAuth,60000,1,source) end exports["(SAUR)Info"]:sendMessage(source,"You have 60 seconds to identify as a SAUR clan member.",255,0,0) end end addEventHandler("onPlayerJoin",getRootElement(),clanProtect) addEventHandler("onPlayerChangeNick",getRootElement(),clanProtect) function loginCheck(old,new) if staffTable[getAccountName(new)] then if auth[source] then killTimer(auth[source]) auth[source] = nil exports["(SAUR)Info"]:sendMessage(source,"You have sucessfully identified as a SAUR clan member.",0,255,0) end else if auth[source] then kickPlayer(source,"Suspected SAUR imposter") killTimer(auth[source]) auth[source] = nil end end end addEventHandler("onPlayerLogin",getRootElement(),loginCheck) function checkAuth(source) if not staffTable[getAccountName(getPlayerAccount(source))] then kickPlayer(source,"Suspected SAUR imposter") killTimer(auth[source]) auth[source] = nil end end function onJobCommandCalled(thePlayer, commandName) if (callCommands[commandName]) then if (isTimer(antiCmdSpam[thePlayer])) then exports["(SAUR)Info"]:sendMessage(thePlayer,"Please wait ".. tostring(math.floor(getTimerDetails(antiCmdSpam[thePlayer])/1000%60)) .." seconds to send another request.",255,0,0) return end local theJob = callCommands[commandName][2] for i,v in pairs(getPlayersByJob(theJob)) do exports['(SAUR)Info']:sendMessage(v,getPlayerName(thePlayer) .." ".. callCommands[commandName][1] .." "..getElementZoneName(thePlayer)..", "..getElementZoneName(thePlayer,true)..".",255,255,0) end antiCmdSpam[thePlayer] = setTimer(function (thePlayer) antiCmdSpam[thePlayer] = nil end, 60000, 1, thePlayer) exports['(SAUR)Info']:sendMessage(thePlayer,"Request sent!",255,255,0) end end function destroyPlayerBlip(player) if player and isElement(plrBlips[player]) then destroyElement(plrBlips[player]) plrBlips[player] = nil skipBlips[player] = true end end function createPlayerBlip(player) if not plrBlips[player] then local r, g, b = getPlayerNametagColor(player) plrBlips[player] = createBlipAttachedTo(player,0,2,r,g,b,255,0,1500) skipBlips[player] = false 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