mint3d Posted April 13, 2013 Share Posted April 13, 2013 Ok i made my self a job for FBI but i want it so only people in FBI team can take it Client local marker = createMarker( 825.55047607422, -2058.07934570311, 11.8671875, "Cylinder", 1.4, 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,"[sGN] FBI 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 FBIjob(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, FBIjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, FBIjobleave) function joinTeam() triggerServerEvent("setFBI",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeFBI",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeFBIWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeFBIWindow, false) Server function createFBITeam () FBIteam = createTeam ("FBI", 196, 196, 196) end addEventHandler ("onResourceStart", resourceRoot, createFBITeam) function joinFBI() setPlayerTeam(source,FBIteam) setElementModel(source, 286) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "FBI", true ) outputChatBox("You are now FBI.",source,196,196,196) end addEvent("setFBI", true) addEventHandler("setFBI",root,joinFBI) function removeFBI() 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("removeFBI", true) addEventHandler("removeFBI",root,removeFBI) function FBIJob ( 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 ) == "police" or getTeamName( theTeam ) == "SWAT" 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 60 seconds.", source ) local playeraccount = getPlayerAccount ( attacker ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel (source, 0) end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) Link to comment
Castillo Posted April 14, 2013 Share Posted April 14, 2013 You must check their team with: getPlayerTeam getTeamName inside "FBIjob" function. 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