Jump to content

justn

Members
  • Posts

    525
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by justn

  1. Client: addEvent("ShowTheGui",true) addEventHandler("ShowTheGui",root, function() showJobWindow(true) end) jobWnd = guiCreateWindow(503,255,327,267,"test",false) guiWindowSetSizable(jobWnd,false) jobLabel = guiCreateLabel(11,24,303,186,"DESCRIPTION",false,jobWnd) guiSetFont(jobLabel,"clear-normal") takeButt = guiCreateButton(11,219,141,36,"Take Job",false,jobWnd) closeButt = guiCreateButton(173,219,141,36,"Close",false,jobWnd) addEventHandler("onClientGUIClick", closeButt, function() showJobWindow(false) end, false) guiSetVisible(jobWnd, false) addEventHandler("onClientGUIClick", takeButt, function() if enabled then if job == "Detective" and arrests < 150 then outputChatBox("You need "..150-arrests.." arrests before you can get this job!", 255, 0, 0) return end if job == "Traffic Officer" and arrests < 75 then outputChatBox("You need "..75-arrests.." arrests before you can get this job!", 255, 0, 0) return end outputChatBox("You are now employed as a "..job.." !", 0, 255, 0) guiSetVisible(jobWnd, false) triggerServerEvent("givePlayerJob", localPlayer, job, team, cR, cG, cB, skinID, skinRequired) else outputChatBox("This job is not available yet!", 255, 0, 0) end end, false) function showJobWindow(state) if state == true then guiSetVisible(jobWnd, true) guiSetText(jobLabel, tostring(info)) guiSetText(jobWnd, tostring(job)) else guiSetVisible(jobWnd, false) end end addEventHandler("onClientPedDamage", root, function() if (getElementData(source, "job.ped") == true) then cancelEvent() end end) bindKey("m", "down", function() showCursor(not isCursorShowing()) end) Server: for i = 1, #teams do team = createTeam(teams[i][1], teams[i][2], teams[i][3], teams[i][4]) end addEventHandler("onResourceStart", resourceRoot, function() for i = 1, #jobs do local players = getElementsByType("player") marker = createMarker(0,0,0,"cylinder",1,255,255,0,255) ped = createPed(jobs[i][2], jobs[i][3], jobs[i][4], jobs[i][5]) setElementRotation(ped, 0, 0, jobs[i][6]) setElementFrozen(ped, true) setElementData(ped, "job.ped", true) setElementData(ped, "job.title", jobs[i][1]) setElementData(ped, "job.team", jobs[i][7]) setElementData(ped, "job.info", jobs[i][9]) setElementData(ped, "job.r", jobs[i][10]) setElementData(ped, "job.g", jobs[i][11]) setElementData(ped, "job.b", jobs[i][12]) setElementData(ped, "job.skin", jobs[i][2]) setElementData(ped, "job.skinRequired", jobs[i][8]) setElementData(ped, "job.enabled", jobs[i][13]) blip = createBlip(jobs[i][3], jobs[i][4], jobs[i][5], 56, 2, 255, 255, 255, 255, 0, 350.0, root) attachElements(marker,ped,0,0,1) end end) addEventHandler("onMarkerHit",marker, function(player) triggerClientEvent("ShowTheGui",getRootElement()) end) addEvent("givePlayerJob", true) addEventHandler("givePlayerJob", root, function(job, team, r, g, b, skinID, skinRequired) local pTeam = getTeamFromName(team) setPlayerTeam(source, pTeam) setElementData(source, "Role", job) setPlayerNametagColor(source, r, g, b) if skinRequired then setElementModel(source, skinID) end if job == "Paramedic" then giveWeapon(source, 41, 9999, true) elseif job == "Police Officer" or job == "Detective" or job == "Traffic Officer" then giveWeapon(source, 3, 1, true) end end) 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)
  2. for i = 1, #teams do team = createTeam(teams[i][1], teams[i][2], teams[i][3], teams[i][4]) end addEventHandler("onResourceStart", resourceRoot, function() for i = 1, #jobs do local players = getElementsByType("player") local marker = createMarker(0,0,0,"cylinder",1,255,255,0,255) ped = createPed(jobs[i][2], jobs[i][3], jobs[i][4], jobs[i][5]) setElementRotation(ped, 0, 0, jobs[i][6]) setElementFrozen(ped, true) setElementData(ped, "job.ped", true) setElementData(ped, "job.title", jobs[i][1]) setElementData(ped, "job.team", jobs[i][7]) setElementData(ped, "job.info", jobs[i][9]) setElementData(ped, "job.r", jobs[i][10]) setElementData(ped, "job.g", jobs[i][11]) setElementData(ped, "job.b", jobs[i][12]) setElementData(ped, "job.skin", jobs[i][2]) setElementData(ped, "job.skinRequired", jobs[i][8]) setElementData(ped, "job.enabled", jobs[i][13]) blip = createBlip(jobs[i][3], jobs[i][4], jobs[i][5], 56, 2, 255, 255, 255, 255, 0, 350.0, root) attachElements(marker,ped,0,0,1) end end) addEvent("givePlayerJob", true) addEventHandler("givePlayerJob", root, function(job, team, r, g, b, skinID, skinRequired) local pTeam = getTeamFromName(team) setPlayerTeam(source, pTeam) setElementData(source, "Role", job) setPlayerNametagColor(source, r, g, b) if skinRequired then setElementModel(source, skinID) end if job == "Paramedic" then giveWeapon(source, 41, 9999, true) elseif job == "Police Officer" or job == "Detective" or job == "Traffic Officer" then giveWeapon(source, 3, 1, true) end end) 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)
  3. for i = 1, #teams do team = createTeam(teams[i][1], teams[i][2], teams[i][3], teams[i][4]) end addEventHandler("onResourceStart", resourceRoot, function() for i = 1, #jobs do local players = getElementsByType("player") local marker = createMarker(0,0,0,"cylinder",1,255,255,0,255) ped = createPed(jobs[i][2], jobs[i][3], jobs[i][4], jobs[i][5]) setElementRotation(ped, 0, 0, jobs[i][6]) setElementFrozen(ped, true) setElementData(ped, "job.ped", true) setElementData(ped, "job.title", jobs[i][1]) setElementData(ped, "job.team", jobs[i][7]) setElementData(ped, "job.info", jobs[i][9]) setElementData(ped, "job.r", jobs[i][10]) setElementData(ped, "job.g", jobs[i][11]) setElementData(ped, "job.b", jobs[i][12]) setElementData(ped, "job.skin", jobs[i][2]) setElementData(ped, "job.skinRequired", jobs[i][8]) setElementData(ped, "job.enabled", jobs[i][13]) blip = createBlip(jobs[i][3], jobs[i][4], jobs[i][5], 56, 2, 255, 255, 255, 255, 0, 350.0, root) attachElements(marker,ped,0,0,2) end end) addEvent("givePlayerJob", true) addEventHandler("givePlayerJob", root, function(job, team, r, g, b, skinID, skinRequired) local pTeam = getTeamFromName(team) setPlayerTeam(source, pTeam) setElementData(source, "Role", job) setPlayerNametagColor(source, r, g, b) if skinRequired then setElementModel(source, skinID) end if job == "Paramedic" then giveWeapon(source, 41, 9999, true) elseif job == "Police Officer" or job == "Detective" or job == "Traffic Officer" then giveWeapon(source, 3, 1, true) end end) 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)
  4. The marker has not been created
  5. Here you go. for i = 1, #teams do team = createTeam(teams[i][1], teams[i][2], teams[i][3], teams[i][4]) end addEventHandler("onResourceStart", resourceRoot, function() for i = 1, #jobs do local players = getElementsByType("player") ped = createPed(jobs[i][2], jobs[i][3], jobs[i][4], jobs[i][5]) setElementRotation(ped, 0, 0, jobs[i][6]) setElementFrozen(ped, true) setElementData(ped, "job.ped", true) setElementData(ped, "job.title", jobs[i][1]) setElementData(ped, "job.team", jobs[i][7]) setElementData(ped, "job.info", jobs[i][9]) setElementData(ped, "job.r", jobs[i][10]) setElementData(ped, "job.g", jobs[i][11]) setElementData(ped, "job.b", jobs[i][12]) setElementData(ped, "job.skin", jobs[i][2]) setElementData(ped, "job.skinRequired", jobs[i][8]) setElementData(ped, "job.enabled", jobs[i][13]) blip = createBlip(jobs[i][3], jobs[i][4], jobs[i][5], 56, 2, 255, 255, 255, 255, 0, 350.0, root) createBlipAttachedTo(marker, 55) attachElements(marker,ped) end end)
  6. justn

    Scores help

    function onQuit () local account = getPlayerAccount(source) if account and not (isGuestAccount (account)) then local kills = getElementData(source, "kills") local deaths = getElementData(source,"deaths") local self = getElementData(source,"self") local ratio = getElementData(source,"ratio") setAccountData (account, "kills", kills ) setAccountData (account, "deaths", deaths ) setAccountData (account, "self", self ) setAccountData (account, "ratio", ratio ) end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onLogin () local acc = getPlayerAccount(source) local kills = getAccountData(acc, "kills") local deaths = getAccountData(acc, "deaths") local self = getAccountData(acc, "self") local ratio = getAccountData(acc, "ratio") setElementData(source, "kills", kills) setElementData(source, "deaths", deaths) setElementData(source, "self", self) setElementData(source, "ratio", ratio) end addEventHandler("onPlayerLogin", getRootElement(), onLogin)
  7. justn

    [Run Fast]

    Use this setGameSpeed
  8. Use this showPlayerHudComponent
  9. Instead of destroying the element, I think you should use 'setElementVisibleTo' (Which is a server-sided function) and remove the event handler when the player hits the marker.
  10. justn

    [HELP] Login

    Just use this code server-sided addEventHandler ( "onPlayerJoin", root, function ( ) fadeCamera ( source, true ) end )
  11. local star = nil local area = nil function nostar() setTimer(function() if isElement(star) then destroyElement(star) end if isElement(area) then destroyElement(area) end star = createObject (1247, 653.35773, -1769.18567, 13.57368 ) area = createColRectangle ( 648.35773, -1774.18567, 10, 10 ) addEventHandler ( "onColShapeHit", area, function( hitElement, matchingDimension ) if getElementType ( hitElement ) == "player" then if getPlayerWantedLevel(hitElement) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(hitElement)-1) destroyElement(star) end elseif getElementType ( hitElement ) == "vehicle" then local player = getVehicleOccupant(hitElement) if player and getPlayerWantedLevel(player) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(player)-1) destroyElement(star) end end end,60000,0) end) end addEventHandler("onResourceStart",resourceRoot,nostar)
  12. bindKey("n","down", function() -- YOUR CODE HERE end)
  13. @Citizen You're welcome. @TheCapn Use this code below addEventHandler("onPlayerLogout",root, function(player) local acc = getPlayerAccount(player) if acc and not isGuestAccount ( acc ) then local DoubleColt = getPedStat(player,69) setAccountData(acc, "double.colt", DoubleColt ) end end ) addEventHandler("onPlayerLogin",root, function(player) local acc = getPlayerAccount(player) local DoubleColt = getAccountData(acc,"double.colt") setPedStat ( player, DoubleColt, 1000 ) end ) addEventHandler("onPlayerJoin",root, function(player) setPedStat ( player, 69, 1000 ) end )
  14. setPedStat (player, 69, 1000 )
  15. function nostar() setTimer(function() star = createPickup (653.35773, -1769.18567, 13.57368, 3, 1247, 60000 ) addEventHandler("onPickupHit",star, function(player) if not getPlayerWantedLevel(player) == 0 then setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(star) end end) end,60000,0) end addEventHandler("onResourceStart",resourceRoot,nostar) Edit:// Use this code below to clear up the debug errors function nostar() setTimer(function() star = createPickup (653.35773, -1769.18567, 13.57368, 3, 1247, 60000 ) addEventHandler("onPickupHit",star, function(player) if isElement( star ) and getElementType(star) == "pickup" and getElementModel(star) == 1247 then if not getPlayerWantedLevel(player) == 0 then setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(star) end end end) end,60000,0) end addEventHandler("onResourceStart",resourceRoot,nostar)
  16. Try this. local teamPlayers = getPlayersInTeam(aTeam) for playerKey, playerValue in ipairs ( teamPlayers ) do triggerClientEvent(playerValue , "dxUpdateVsBar", playerValue , "test") end
  17. I have this code, it works but other players cant hear. Client n = 1 Font = dxCreateFont("font.ttf", 21) local radios = { {"None","None",8}, {"http://www.raggakings.net/listen.m3u","Reggae and Dancehall",7}, {"http://www.hit104.com/listen.pls", "Hit 104",6}, {"http://mp3uplink.duplexfx.com:8054/listen.pls","West Coast Rap",5}, {"http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls","Power 181",4}, {"http://somafm.com/dubstep.pls","Dubstep",3}, {"http://193.34.51.25/listen.pls","rauteMusik.",2}, {"http://212.45.104.34:8042/listen.pls","Defjay",1} } title = "Radio Off" addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) title = streamTitle end) addEventHandler("onClientSoundStream",root,function(suc,length,streamN) title = streamN end) function onPlayerEnterVehicle(vehicle,seat) if ( source == localPlayer ) then if seat == 0 or seat == 1 or seat == 2 or seat == 3 or seat == 4 then setRadioChannel(0) addEventHandler("onClientRender", getRootElement(), RenderClient) bindKey("mouse_wheel_up", "down", PlaySound, "up") bindKey("mouse_wheel_down", "down", PlaySound, "down") end end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle) function stopMySound(vehicle,seat) if ( source == localPlayer ) then if seat == 0 or seat == 1 or seat == 2 or seat == 3 or seat == 4 then if sound then triggerServerEvent("pauseSound",localPlayer) end removeEventHandler("onClientRender", getRootElement(), RenderClient) unbindKey("mouse_wheel_up", "down", PlaySound) unbindKey("mouse_wheel_down", "down", PlaySound) n = 1 end end end addEventHandler("onClientPlayerVehicleExit",getRootElement(),stopMySound) function RenderClient() if isPedInVehicle(localPlayer) then local x,y = guiGetScreenSize() dxDrawText("Song Name: "..title, x*387/1024, y*631/768, x*800/1024, y*646/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) dxDrawText("Radio: "..tostring(radiotitle), x*387/1024, y*616/768, x*760/1024, y*631/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) end end function PlaySound(state) local x,y,z = getElementPosition(getLocalPlayer()) n = tonumber(n) if sound then triggerServerEvent("pauseSound",localPlayer) setRadioChannel(0) end if state == "mouse_wheel_up" then if n < #radios then n = n + 1 setRadioChannel(0) end elseif state == "mouse_wheel_down" then if n > 1 then n = n - 1 setRadioChannel(0) end end triggerServerEvent("playSound",localPlayer,x,y,z) setRadioChannel(0) end function UpdateSound() if sound then attachElements(sound,getPedOccupiedVehicle(getLocalPlayer())) end end addEventHandler("onClientRender", getRootElement(), UpdateSound) addEvent("startSound",true) addEventHandler("startSound",root, function(x,y,z) sound = playSound3D(radios[n][1], x,y,z) radiotitle = radios[n][2] end) addEvent("StopSound",true) addEventHandler("StopSound",root, function() stopSound(sound) sound = nil end) Server addEvent("playSound",true) addEventHandler("playSound",root, function(x,y,z) triggerClientEvent("startSound",root,x,y,z) end) addEvent("pauseSound",true) addEventHandler("pauseSound",root, function() triggerClientEvent("StopSound",root) end)
  18. Hi, I have a problem with this script im making ( for jail break ).. well, the problem is that the gate doesn't move.. i would like if someone can help please thanks. gate1 = createObject(980, 3535.1999511719, -1804.6999511719, 28.39999961853, 0, 0, 270) gate2 = createObject(980, 3535.3000488281, -1815.5999755859, 28.39999961853, 0, 0, 270) addEventHandler("onClientMarkerHit",marker, function(hitElement,matchingDimension) if ( hitElement == localPlayer ) then if not isPedInVehicle(localPlayer) and isElementWithinMarker(localPlayer,marker) then guiSetVisible(JailBreak_Progress,true) timer1 = setTimer(function() guiProgressBarSetProgress(JailBreak_Progress,guiProgressBarGetProgress(JailBreak_Progress)+1) end,1000,0) timer2 = setTimer(moveGate,5000,1) timer3 = setTimer(label,1000,0) end end end) function moveGate() if ( guiProgressBarGetProgress(JailBreak_Progress) == 100 ) then moveObject(gate1, 2000, 3535.3000488281, -1815.5999755859, 20.39999961853) moveObject(gate2, 2000, 3535.3000488281, -1815.5999755859, 20.39999961853) setTimer(function() moveObject(gate1, 2000, 3535.1999511719, -1804.6999511719, 28.39999961853) moveObject(gate2, 2000, 3535.1999511719, -1804.6999511719, 28.39999961853) end,20000,1) end end
  19. justn

    Interior Marker

    You must change "INTERIOR HERE" and "DIMENSION HERE" to the interior and dimension where you want the marker to be.
  20. justn

    Interior Marker

    local marker = createMarker(1114.09,1351.40,11.69, "arrow", 1.5, 239, 213, 0) addEventHandler("onMarkerHit", marker, function (player) setElementPosition(player, 1120.90,1365.80,-23.10) setElementInterior(player, 0) -- change number to the house number ! end ) local marker2 = createMarker(1120.90,1365.80,-23.10, "arrow", 1.5, 239, 213, 0) setElementInterior(marker2,INTERIOR HERE) setElementDimension(marker2, DIMENSION HERE) addEventHandler("onMarkerHit", marker2, function (player) setElementPosition(player, 1114.09,1351.40,11.69) setElementInterior(player, 0) end )
×
×
  • Create New...