Jump to content

litlle help with script


Recommended Posts

ok I have a panel and I want it to be visible for people in police group only so I made this code but when I tested it it didn't work the panel can be opened by anyone have the access to the admin panel

[lua]addEventHandler("onPlayerLogin",root, 
    function (_,acc) 
        if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then 
            outputChatBox("*  Press n To Open Police Panel",source,255,255,255,true) 
        end 
    end 
) 

[/lua]

Link to comment
That code is not the problem, post the whole script.

---Server Side

addEventHandler("onPlayerLogin",root, 
    function (_,acc) 
        if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then 
            outputChatBox("* Welcome Admin Man Press n To Open Admin Panel",source,255,255,255,true) 
        end 
    end 
) 
  
addEvent( "destroy", true) ----destroy car 
addEventHandler( "destroy", getRootElement(), 
function ( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    local theVehicle = getPedOccupiedVehicle ( toWho ) 
    if ( isElement(theVehicle) ) then 
         destroyElement ( theVehicle ) 
         outputChatBox("* Your vehicle has been destroyed by ".. name .."", toWho, 255, 0, 0, true ) 
    else outputChatBox("* he don't have a car !!", source, 255, 0, 0, true ) 
    end 
end ) 
  
--------------- 
  
addEvent("slap", true) 
function slap( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    data = 100 
    if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then 
    if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho ) 
    else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end 
        local x, y, z = getElementVelocity ( toWho ) 
        setElementVelocity ( toWho, x , y, z + 0.2 )     
        outputChatBox("* [ #ffff00".. PlayerNick .."#ff0000 ] #999999 has been slapped by#ff0000 [ #ffff00" .. name .."#ff0000 ]", root, 255, 0, 0, true ) 
      end 
end 
addEventHandler("slap", getRootElement(),slap) 
  
------------------ 
  
function loggedOut ( ) 
    triggerClientEvent ( source, "police", source, false ) 
end 
addEventHandler( "onPlayerLogout", getRootElement(), loggedOut ) 
  
function polstart ( player ) 
local accName = getAccountName ( getPlayerAccount ( player ) ) 
    if ( hasObjectPermissionTo ( player, "function.kickPlayer", false ) ) then 
        triggerClientEvent ( player, "police", player, true ) 
    end 
end 
addEvent( "polstart", true ) 
addEventHandler( "polstart", getRootElement(), polstart ) 
  
function onPlayerLogin ( ) 
    polstart ( source )  
end 
addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin ) 

Edited by Guest
Link to comment
addEventHandler("onPlayerLogin",root, 
    function (_,acc) 
        if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then 
            outputChatBox("* Welcome Admin Man Press n To Open Admin Panel",source,255,255,255,true) 
        end 
    end 
) 
  
addEvent( "destroy", true) ----destroy car 
addEventHandler( "destroy", getRootElement(), 
function ( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    local theVehicle = getPedOccupiedVehicle ( toWho ) 
    if ( isElement(theVehicle) ) then 
         destroyElement ( theVehicle ) 
         outputChatBox("* Your vehicle has been destroyed by ".. name .."", toWho, 255, 0, 0, true ) 
    else outputChatBox("* he don't have a car !!", source, 255, 0, 0, true ) 
    end 
end ) 
  
--------------- 
  
addEvent("slap", true) 
function slap( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    data = 100 
    if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then 
    if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho ) 
    else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end 
        local x, y, z = getElementVelocity ( toWho ) 
        setElementVelocity ( toWho, x , y, z + 0.2 )    
        outputChatBox("* [ #ffff00".. PlayerNick .."#ff0000 ] #999999 has been slapped by#ff0000 [ #ffff00" .. name .."#ff0000 ]", root, 255, 0, 0, true ) 
      end 
end 
addEventHandler("slap", getRootElement(),slap) 
  
------------------ 
  
function loggedOut ( ) 
    triggerClientEvent ( source, "police", source, false ) 
end 
addEventHandler( "onPlayerLogout", getRootElement(), loggedOut ) 
  
function polstart ( player ) 
    local accName = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup("user." .. accName, aclGetGroup("Police")) then 
        triggerClientEvent ( player, "police", player, true ) 
    end 
end 
addEvent( "polstart", true ) 
addEventHandler( "polstart", getRootElement(), polstart ) 
  
function onPlayerLogin ( ) 
    polstart ( source )  
end 
addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin ) 

Link to comment
addEventHandler("onPlayerLogin",root, 
    function (_,acc) 
        if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then 
            outputChatBox("* Welcome Admin Man Press n To Open Admin Panel",source,255,255,255,true) 
        end 
    end 
) 
  
addEvent( "destroy", true) ----destroy car 
addEventHandler( "destroy", getRootElement(), 
function ( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    local theVehicle = getPedOccupiedVehicle ( toWho ) 
    if ( isElement(theVehicle) ) then 
         destroyElement ( theVehicle ) 
         outputChatBox("* Your vehicle has been destroyed by ".. name .."", toWho, 255, 0, 0, true ) 
    else outputChatBox("* he don't have a car !!", source, 255, 0, 0, true ) 
    end 
end ) 
  
--------------- 
  
addEvent("slap", true) 
function slap( PlayerNick ) 
    local toWho = getPlayerFromName ( PlayerNick ) 
    local name = getPlayerName ( source ) 
    data = 100 
    if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then 
    if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho ) 
    else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end 
        local x, y, z = getElementVelocity ( toWho ) 
        setElementVelocity ( toWho, x , y, z + 0.2 )    
        outputChatBox("* [ #ffff00".. PlayerNick .."#ff0000 ] #999999 has been slapped by#ff0000 [ #ffff00" .. name .."#ff0000 ]", root, 255, 0, 0, true ) 
      end 
end 
addEventHandler("slap", getRootElement(),slap) 
  
------------------ 
  
function loggedOut ( ) 
    triggerClientEvent ( source, "police", source, false ) 
end 
addEventHandler( "onPlayerLogout", getRootElement(), loggedOut ) 
  
function polstart ( player ) 
    local accName = getAccountName ( getPlayerAccount ( player ) ) 
    if isObjectInACLGroup("user." .. accName, aclGetGroup("Police")) then 
        triggerClientEvent ( player, "police", player, true ) 
    end 
end 
addEvent( "polstart", true ) 
addEventHandler( "polstart", getRootElement(), polstart ) 
  
function onPlayerLogin ( ) 
    polstart ( source )  
end 
addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin ) 

Thanks for your help :D

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