mint3d Posted April 14, 2013 Posted April 14, 2013 I have made a job but i want it so only people in the 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) Skype: Jordan_Nymph
Max+ Posted April 14, 2013 Posted April 14, 2013 if(getTeamName(getPlayerTeam(localPlayer) == 'FBI' )) then guiSetVisible(windowjob, true) else outputChatBox('You Are Not F.B.I', 255, 255, 0) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Sasu Posted April 14, 2013 Posted April 14, 2013 function FBIjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) and (getTeamName(getPlayerTeam(localPlayer) == 'FBI' )) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end else outputChatBox('You Are Not F.B.I', 255, 255, 0) end end addEventHandler("onClientMarkerHit", marker, FBIjob) State: Inactive
mint3d Posted April 14, 2013 Author Posted April 14, 2013 ok i done but when anyone walks in to it everyone can see Skype: Jordan_Nymph
Max+ Posted April 14, 2013 Posted April 14, 2013 Sasuke and on Leave ? and it's not need to to hitElement = localPlayer just do it like this , 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 guiSetVisible(windowjob, false) showCursor(false) 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 (getTeamName(getPlayerTeam(hitElement) == 'FBI' )) then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox('You Must Be on FBI Team To Do This ',255, 0, 0) end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if getElementType(hitElement) == 'player' and (getTeamName(getPlayerTeam(hitElement) == 'FBI' )) 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) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
mint3d Posted April 14, 2013 Author Posted April 14, 2013 and we cant take job either when in team FBI Skype: Jordan_Nymph
mint3d Posted April 14, 2013 Author Posted April 14, 2013 now we FBI cant open gui Skype: Jordan_Nymph
Max+ Posted April 14, 2013 Posted April 14, 2013 What You Mean if you hit the Marker does it work and if you press Join Button what happend ? /deubgscript 3 - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
mint3d Posted April 14, 2013 Author Posted April 14, 2013 any of these getPlayerTeam getTeamName Skype: Jordan_Nymph
Max+ Posted April 14, 2013 Posted April 14, 2013 ---ServerSide --- 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 (attacker ~=source ) then theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if ( getPlayerTeam (attacker ) and getTeamName( getPlayerTeam ( attacker ) ) == "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(),FBIJob) ---ClientSide 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 guiSetVisible(windowjob, false) showCursor(false) 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 ( getPlayerTeam ( hitElement ) and getTeamName( getPlayerTeam ( hitElement ) ) == "FBI" ) then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox('You Must Be on FBI Team To Do This ',255, 0, 0) end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if (getElementType(hitElement) == 'player' ) 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) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
iPrestege Posted April 14, 2013 Posted April 14, 2013 -- Client Side -- 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 showCursor(false) 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' ) then if getPlayerTeam(hitElement) and getTeamName(getPlayerTeam(hitElement)) == "FBI" then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox('You Must Be on FBI Team To Do This ',255, 0, 0) end end end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if (getElementType(leaveElement) == 'player' ) then guiSetVisible(windowjob, false) showCursor(false) 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 Side -- 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 (attacker ~=source ) then theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if ( getPlayerTeam (attacker ) and getTeamName( getPlayerTeam ( attacker ) ) == "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(),FBIJob) To Show The GUI You Must Be On "FBI" Team!
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