mint3d Posted April 22, 2013 Share Posted April 22, 2013 i have made a script but when you walk in marker everybody see the info and the You must be in SWAT to do this etc can you help Server function createSWATTeam () SWATteam = createTeam ("SWAT", 0, 0, 255) end addEventHandler ("onResourceStart", resourceRoot, createSWATTeam) function joinSWAT() setPlayerTeam(source,SWATteam) setElementModel(source, 285) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "SWAT", 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 ) == "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) Client local marker = createMarker( 1288.7602539063, -1642.1657714844, 12.5, "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 showCursor(false) windowjob = guiMyCwindow(301,170,"[sGN] 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' ) then if getPlayerTeam(hitElement) and getTeamName(getPlayerTeam(hitElement)) == "SWAT" then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox('You Must Be on SWAT Team To Do This ',255, 0, 0) end end end addEventHandler("onClientMarkerHit", marker, SWATjob) function SWATjobleave(leaveElement) if (getElementType(leaveElement) == 'player' ) then guiSetVisible(windowjob, false) showCursor(false) 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
iPrestege Posted April 22, 2013 Share Posted April 22, 2013 What you mean by "Info" ? Link to comment
mint3d Posted April 22, 2013 Author Share Posted April 22, 2013 Like when it come up Take Job Leave Job and Cancel and all players can see that and the bit You need to be swat to do this Link to comment
Jaysds1 Posted April 22, 2013 Share Posted April 22, 2013 (edited) try this: Server: local SWATteam addEventHandler ("onResourceStart", resourceRoot,function(res) if res~=resource then return end SWATteam = createTeam ("SWAT", 0, 0, 255) end) addEvent("setSWAT", true) addEventHandler("setSWAT",root,function() setPlayerTeam(source,SWATteam) setElementModel(source, 285) giveWeapon ( source, 3 ) local playeraccount = getPlayerAccount( source ) setAccountData(playeraccount, "team", "SWAT")--Only 3 arguements outputChatBox("You are now SWAT.",source,0,0,255) end) addEvent("removeSWAT", true) addEventHandler("removeSWAT",root,function() setPlayerTeam(source, 0) local playeraccount = getPlayerAccount(source) setElementModel(source,getAccountData(playeraccount,"standardskin") or 0) outputChatBox("You are now an unemployed.",source,255,0,0) end) local arrestTeam = {["police"]=true,["SWAT"]=true,["FBI"]=true} addEventHandler ("onPlayerDamage",root,function( attacker, attackerweapon, bodypart, loss ) if not attacker or getElementType(attacker)~="player" then return end local theTeam = getPlayerTeam ( attacker ) local theWL = getPlayerWantedLevel ( source ) local theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if arrestTeam[getTeamName( theTeam )] then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) local theName = getPlayerName ( source ) local theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 60 seconds.", source ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel(source, 0) end end end) --why do you have policeJob instead of SWATjob Client: local marker = createMarker( 1288.7602539063, -1642.1657714844, 12.5, "Cylinder", 1.4, 0, 0, 255, 255) local GUIEditor_Button = {} local GUIEditor_Memo = {} local GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end local windowjob = guiMyCwindow(301,170,"[sGN] SWAT Team ") 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) guiSetVisible(windowjob, false) addEventHandler("onClientMarkerHit",marker,function(ele) if getElementType(ele)~="player"then return end local pTeam = getPlayerTeam(ele) if pTeam and getTeamName(pTeam)~="SWAT"then guiSetVisible(windowjob, true) showCursor(true) end end) addEventHandler("onClientMarkerLeave", marker, function(ele) if getElementType(ele)~='player'then return end guiSetVisible(windowjob, false) showCursor(false) end) addEventHandler("onClientGUIClick",guiRoot,function() if source==GUIEditor_Button[1]then triggerServerEvent("setSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) elseif source==GUIEditor_Button[2]then guiSetVisible(windowjob, false) showCursor(false) elseif source==GUIEditor_Button[3]then triggerServerEvent("removeSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end end,true) Edited April 22, 2013 by Guest Link to comment
mint3d Posted April 22, 2013 Author Share Posted April 22, 2013 i have police because from my police script but i dont' know how to make it by wanted level the jail time Link to comment
mint3d Posted April 22, 2013 Author Share Posted April 22, 2013 It still shows up about the You must be in swat to do this and Take job Quit job and Cancel Link to comment
mint3d Posted April 22, 2013 Author Share Posted April 22, 2013 and it say You are now SWAT only i can see Link to comment
Jaysds1 Posted April 22, 2013 Share Posted April 22, 2013 Copy the client code again please, and try it Link to comment
Jaysds1 Posted April 22, 2013 Share Posted April 22, 2013 try this again please: Client: local marker = createMarker( 1288.7602539063, -1642.1657714844, 12.5, "Cylinder", 1.4, 0, 0, 255, 255) local GUIEditor_Button = {} local GUIEditor_Memo = {} local GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end local windowjob = guiMyCwindow(301,170,"[sGN] SWAT Team ") 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) guiSetVisible(windowjob, false) addEventHandler("onClientMarkerHit",marker,function(ele) if getElementType(ele)~="player"then return end local pTeam = getPlayerTeam(ele) if pTeam and getTeamName(pTeam)~="SWAT"then guiSetVisible(windowjob, true) showCursor(true) end end) addEventHandler("onClientMarkerLeave", marker, function(ele) if getElementType(ele)~='player'then return end guiSetVisible(windowjob, false) showCursor(false) end) addEventHandler("onClientGUIClick",guiRoot,function() if source==GUIEditor_Button[1]then triggerServerEvent("setSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) elseif source==GUIEditor_Button[2]then guiSetVisible(windowjob, false) showCursor(false) elseif source==GUIEditor_Button[3]then triggerServerEvent("removeSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end end,true) 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