Jump to content

[Question] SWAT Job


gghvcffcv

Recommended Posts

Hello guys, How could i restrict this for an ACL Group, i tried but it didn't work, if anyone can help me Please.

Server:

createTeam ( "SWAT", 0, 0, 255 ) 
  
function aceptarr ( ) 
    local theTeam = getTeamFromName ( "SWAT" ) 
    if ( theTeam ) then 
        setPlayerTeam ( source, theTeam ) 
        setPlayerNametagColor ( source, 0, 0, 255 ) 
        setElementModel ( source, 285 ) 
        giveWeapon ( source, 31, 550 ) 
        giveWeapon ( source, 23, 550 ) 
        giveWeapon ( source, 3, 550 ) 
        giveWeapon ( source, 29, 550 ) 
        giveWeapon ( source, 46, 550 ) 
        giveWeapon ( source, 41, 5000 ) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, aceptarr ) 

Client:

marker5 = createMarker( 1288.17566, -1641.94141, 12.54688, "Cylinder", 1, 0, 0, 255, 200) 
pedi = createPed ( 285, 1288.17566, -1641.94141, 13.54688, 270) 
blipA = createBlip ( 1288.17566, -1641.94141, 13.54688, 58, 2, 255, 0,0, 255) 
  
function panel(hitElement) 
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
        local playerTeam = getPlayerTeam ( localPlayer ) 
        if ( playerTeam ) then           
            local oldTeamName = getTeamName ( playerTeam ) 
            if ( oldTeamName ~= "SWAT" ) then 
            setElementFrozen (pedi, true) 
                panel = guiCreateWindow(443, 132, 416, 514, "S.W.A.T Job", false) 
                guiWindowSetSizable(panel, false) 
  
                aceptar = guiCreateButton(16, 282, 169, 72, "Accept", false, panel) 
                cerrar = guiCreateButton(230, 282, 169, 72, "Close", false, panel) 
                memo = guiCreateMemo(12, 26, 382, 238, "Welcome to the SWAT Job Accept this job if you are an SWAT\nIf you aren't a swat You cannot accept this Job.", false, panel) 
        
                showCursor (true) 
                addEventHandler ("onClientGUIClick", aceptar, aceptarr, false ) 
                addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) 
                guiMemoSetReadOnly(memo, true)     
            end 
        end 
    end     
end 
addEventHandler("onClientMarkerHit", marker5, panel ) 
  
function aceptarr ( thePlayer ) 
triggerServerEvent ( "onGreeting", localPlayer) 
guiSetVisible ( panel, false ) 
showCursor(false) 
end 
  
  
function cerrarr ( hitElement ) 
guiSetVisible ( panel, false ) 
showCursor(false) 
end 

Link to comment
Use the following functions:
getPlayerAccount 
getAccountName 
aclGetGroup 
isObjectInACLGroup 

function aceptarr () 
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "SWAT" ) ) then -- Does he have access to Admin functions? 
        local theTeam = getTeamFromName ( "SWAT" ) 
        if ( theTeam ) then 
        setPlayerTeam ( source, theTeam ) 
        setPlayerNametagColor ( source, 0, 0, 255 ) 
        setElementModel ( source, 285 ) 
        giveWeapon ( source, 31, 550 ) 
        giveWeapon ( source, 23, 550 ) 
        giveWeapon ( source, 3, 550 ) 
        giveWeapon ( source, 29, 550 ) 
        giveWeapon ( source, 46, 550 ) 
        giveWeapon ( source, 41, 5000 ) 
end 
end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, aceptarr ) 

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