Jump to content

Job Marker With Castillo's Gang System


Recommended Posts

For this swat job I want it to be able for users only in the SWAT group using Castillo's gang system.

Client:

local marker = createMarker( 1288.5, -1642.0999755859, 12.5, "Cylinder", 1.8, 0, 0, 255, 255) 
      
    GUIEditor_Button = {} 
        GUIEditor_Memo = {} 
        GUIEditor_Label = {} 
          
        function guiMyCwindow(w,h,t) 
          local x,y = guiGetScreenSize() 
          return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
        end 
          
        windowjob = guiMyCwindow(301,170,"SWAT Team ") 
        guiSetVisible(windowjob, false) 
        GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) 
        GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) 
        GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) 
        GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) 
          
        function SWATjob(hitElement) 
             if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(windowjob) then 
                       guiSetVisible(windowjob, true) 
                       showCursor(true) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerHit", marker, SWATjob) 
          
        function SWATjobleave(leaveElement) 
             if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                  if guiGetVisible(windowjob) then 
                       guiSetVisible(windowjob, false) 
                       showCursor(false) 
                  end 
             end 
        end 
        addEventHandler("onClientMarkerLeave", marker, SWATjobleave) 
          
        function joinTeam() 
             triggerServerEvent("setSWAT",localPlayer) 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
         
        function removeTeam() 
    triggerServerEvent("removeSWAT",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) 
          
        function removeSWATWindow() 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATWindow, false) 
  

Server:

createBlip ( 186.2998046875, 1938.2998046875, 16.8, 56 ) 
  
  
function createSWATTeam () 
    SWATteam = createTeam ("SWAT", 0, 0, 70) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSWATTeam) 
  
function joinSWAT() 
     setPlayerTeam(source,SWATteam) 
     setElementModel(source, 285) 
      giveWeapon ( source, 3 ) 
      playeraccount = getPlayerAccount( source ) 
     setAccountData( playeraccount, "team", "Army", true ) 
     outputChatBox("You are now SWAT.",source,0,0,255) 
end 
addEvent("setSWAT", true) 
addEventHandler("setSWAT",root,joinSWAT) 
  
 function removeSWAT() 
    setPlayerTeam(source, 0) 
    playeraccount = getPlayerAccount(source) 
    if getAccountData(playeraccount, "standardskin") == 0 then 
    setElementModel(source, 0) 
    else 
    setElementModel(source,getAccountData(playeraccount,"standardskin")) 
     end 
     outputChatBox("You are now an unemployed.",source,255,0,0) 
    end 
    addEvent("removeSWAT", true) 
    addEventHandler("removeSWAT",root,removeSWAT) 
  
function SWATJob ( attacker, attackerweapon, bodypart, loss ) 
 if attacker and getElementType(attacker) == "player" then 
        theTeam = getPlayerTeam ( attacker ) 
        theWL = getPlayerWantedLevel ( source ) 
        theSkin = getElementModel ( attacker ) 
        if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then 
            if  getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "MF" or getTeamName( theTeam ) == "FBI" then 
                setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) 
                theName = getPlayerName ( source ) 
                theCop = getPlayerName ( attacker )   
                outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) 
                local playeraccount = getPlayerAccount ( attacker ) 
                givePlayerMoney (attacker, 100) 
                setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)       
                setPlayerWantedLevel (source, 0) 
                end 
            end 
        end 
    end 
    addEventHandler ("onPlayerDamage", getRootElement(), SWATJob) 
  

Link to comment
local marker = createMarker( 1288.5, -1642.0999755859, 12.5, "Cylinder", 1.8, 0, 0, 255, 255) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
function guiMyCwindow(w,h,t) 
    local x,y = guiGetScreenSize() 
    return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
end 
  
windowjob = guiMyCwindow(301,170,"SWAT Team ") 
guiSetVisible(windowjob, false) 
GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) 
GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) 
GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) 
  
function SWATjob(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) and getElementData ( localPlayer, "gang" ) == "SWAT" then 
        if not guiGetVisible(windowjob) then 
            guiSetVisible(windowjob, true) 
            showCursor(true) 
        end 
    end 
end 
addEventHandler("onClientMarkerHit", marker, SWATjob) 
  
function SWATjobleave(leaveElement) 
    if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
        if guiGetVisible(windowjob) then 
            guiSetVisible(windowjob, false) 
            showCursor(false) 
        end 
    end 
end 
addEventHandler("onClientMarkerLeave", marker, SWATjobleave) 
  
function joinTeam() 
    triggerServerEvent("setSWAT",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeTeam() 
    triggerServerEvent("removeSWAT",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) 
  
function removeSWATWindow() 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATWindow, false) 

Link to comment
local marker = createMarker( 1288.5, -1642.0999755859, 12.5, "Cylinder", 1.8, 0, 0, 255, 255) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
function guiMyCwindow(w,h,t) 
    local x,y = guiGetScreenSize() 
    return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
end 
  
windowjob = guiMyCwindow(301,170,"SWAT Team ") 
guiSetVisible(windowjob, false) 
GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) 
GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) 
GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) 
  
function SWATjob(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) and getElementData ( localPlayer, "gang" ) == "SWAT" then 
        if not guiGetVisible(windowjob) then 
            guiSetVisible(windowjob, true) 
            showCursor(true) 
        end 
    end 
end 
addEventHandler("onClientMarkerHit", marker, SWATjob) 
  
function SWATjobleave(leaveElement) 
    if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
        if guiGetVisible(windowjob) then 
            guiSetVisible(windowjob, false) 
            showCursor(false) 
        end 
    end 
end 
addEventHandler("onClientMarkerLeave", marker, SWATjobleave) 
  
function joinTeam() 
    triggerServerEvent("setSWAT",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeTeam() 
    triggerServerEvent("removeSWAT",localPlayer) 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) 
  
function removeSWATWindow() 
    guiSetVisible(windowjob, false) 
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATWindow, false) 

EDIT: Nvm I got it = Client

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...