Jump to content

How to lock scripts to classes/teams


Exile

Recommended Posts

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
  
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

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...