Jump to content

What is wrong ?


novo

Recommended Posts

What is wrong here ?

function (player,cmd,numbermax, playerSource) 
    if ( hasObjectPermissionTo ( playerSource, "command.zsetmax", false ) ) then 
  
        if ( hasObjectPermissionTo ( getThisResource (), "command.zsetmax", true ) ) 
                then if not numbermax then return end 
            setMaxPlayers(tonumber (numbermax)) 
local maxPlayers = getMaxPlayers() 
      outputChatBox("#00FFFF* #FFB900Server max. slots changed to: #FFFFFF" .. maxPlayers .." #00FFFFof #FFFF001024 #00ffffmax.", getRootElement(),255,255,255,true) 
        else 
            outputChatBox ( "zsetmaxplayers: The script isn't added on Admin acl group. Please, add it.", playerSource ) 
        end 
    else 
        outputChatBox ( "zsetmaxplayers: Not enought rights.", playerSource ) 
    end 
end 
  
addCommandHandler ("zsetmaxplayers", ) 

When i do /zsetmaxplayers number, it tell me zsetmaxplayers: Not enought rights, when i have the right command.zsetmax added to Admin ACL and the resource added to Admin ACL Group.

Please help D:

Link to comment

The first argument of the function is the player who typed the command, why did you make another argument for it.

There is a global argument called 'resource' it points to the current resource where the script is a part of.

function (player,cmd,numbermax) 
    if ( hasObjectPermissionTo ( player, "command.zsetmax", false ) ) then 
  
        if ( hasObjectPermissionTo ( resource, "command.zsetmax", true ) ) 
                then if not tonumber(numbermax) then return end 
            setMaxPlayers(tonumber (numbermax)) 
local maxPlayers = getMaxPlayers() 
      outputChatBox("#00FFFF* #FFB900Server max. slots changed to: #FFFFFF" .. maxPlayers .." #00FFFFof #FFFF001024 #00ffffmax.", getRootElement(),255,255,255,true) 
        else 
            outputChatBox ( "zsetmaxplayers: The script isn't added on Admin acl group. Please, add it.", playerSource ) 
        end 
    else 
        outputChatBox ( "zsetmaxplayers: Not enought rights.", playerSource ) 
    end 
end 
  
addCommandHandler ("zsetmaxplayers", ) 

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