Exile Posted May 17, 2014 Share Posted May 17, 2014 Hello everyone,I want to know how to lock specific scripts to classes/teams Like say,I only want a headshot script useable for only a couple of teams/classes. Or jut one... Can anyone tell me how to do so? Is there any code that I can put before every scripts that only these certain teams/classes can use the script Similar to local team = getPlayerTeam(localPlayer) if team and getTeamName(team) == "NAME HERE" then Like only a team can use this FPSLimit = 37 FPSMax = 1 function onClientResourceStart ( resource ) if ( guiFPSLabel == nil ) then FPSLimit = 255 / FPSLimit guiFPSLabel = guiCreateLabel ( 0.03, 0.97, 0.1, 0.1, "FPS: 0", true ) FPSCalc = 0 FPSTime = getTickCount() + 1000 addEventHandler ( "onClientRender", getRootElement (), onClientRender ) end end addEventHandler ( "onClientResourceStart", getRootElement (), onClientResourceStart ) function onClientRender ( ) if ( getTickCount() < FPSTime ) then FPSCalc = FPSCalc + 1 else if ( FPSCalc > FPSMax ) then FPSLimit = 255 / FPSCalc FPSMax = FPSCalc end guiSetText ( guiFPSLabel, "FPS: "..FPSCalc.." Max: "..FPSMax ) guiLabelSetColor ( guiFPSLabel, 255 - math.ceil ( FPSCalc * FPSLimit ), math.ceil ( FPSCalc * FPSLimit ), 0 ) FPSCalc = 0 FPSTime = getTickCount() + 1000 end end Can anyone give me a code/snippet to do so? Link to comment
.:HyPeX:. Posted May 17, 2014 Share Posted May 17, 2014 Thats just a FPS counter, but you should just check the team/class parameters with an if as you are showing there. Link to comment
joriss11 Posted May 18, 2014 Share Posted May 18, 2014 FPSLimit = 37 FPSMax = 1 function onClientResourceStart ( resource ) if getElementData(thePlayer, "Class") == "Classname" then if ( guiFPSLabel == nil ) then FPSLimit = 255 / FPSLimit guiFPSLabel = guiCreateLabel ( 0.03, 0.97, 0.1, 0.1, "FPS: 0", true ) FPSCalc = 0 FPSTime = getTickCount() + 1000 addEventHandler ( "onClientRender", getRootElement (), onClientRender ) end end addEventHandler ( "onClientResourceStart", getRootElement (), onClientResourceStart ) function onClientRender ( ) if ( getTickCount() < FPSTime ) then FPSCalc = FPSCalc + 1 else if ( FPSCalc > FPSMax ) then FPSLimit = 255 / FPSCalc FPSMax = FPSCalc end guiSetText ( guiFPSLabel, "FPS: "..FPSCalc.." Max: "..FPSMax ) guiLabelSetColor ( guiFPSLabel, 255 - math.ceil ( FPSCalc * FPSLimit ), math.ceil ( FPSCalc * FPSLimit ), 0 ) FPSCalc = 0 FPSTime = getTickCount() + 1000 end end You can change thePlayer in the Player thing your using, and Change Class into class if not working. 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