Jump to content

Not so important but need help


Alen141

Recommended Posts

function( categoryIndex, classIndex, skinIndex, password, aclRestrict ) 
        if skinIndex then 
            local class = classGroups[ categoryIndex ].classes[ classIndex ]; 
            if class.aclRestrict then 
            local playerAccountName = getAccountName(getPlayerAccount(player)) 
            if isObjectInACLGroup ("user." .. playerAccountName, aclGetGroup(aclRestrict)) then 
            if not aclRestrict or aclRestrict == "" then 
            outputChatBox( "You have no permission!", client, 200, 50, 50 ); 
                   return; 
            elseif aclRestrict ~= class.aclRestrict then 
                   outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); 
                   end 
                end 
            end 

ERROR: WARNING: spawned\s_main.lua:12: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]

[time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

[time] ERROR: spawned\s_main.lua:13: attempt to concatenate local 'playerAccountName' (a boolean value)

[time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]

[time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

[time] ERROR: spawned\s_main.lua:13: attempt to concatenate local 'playerAccountName' (a boolean value)

Link to comment
show me the client part .
  
Group = { }; 
Group.__index = { }; 
  
function Group: New( groupElement ) 
    local group = { 
        name = "", 
        classes = { }, 
    }; 
    if getElementType( groupElement ) == "category" then 
        setmetatable( group, self ); 
        self.__index = self; 
         
        group.name = getElementData( groupElement, "id" ); 
         
        local children = getElementChildren( groupElement ); 
        for _, child in ipairs( children ) do 
            table.insert( group.classes, Class:New( child ) ); 
        end 
        return group; 
    end 
    return false; 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
Class = { }; 
Class.__index = Class; 
  
function Class: New( classElement ) 
    local class = {  
        name = "", 
        info = "", 
        color = { red = 255, green = 255, blue = 255 }, 
        skinMngr = SkinManager:New( ), 
        weaponMngr = WeaponManager:New( ), 
        cameraMngr = CameraManager:New( ), 
    } 
    if getElementType( classElement ) == "class" then 
        setmetatable( class, self ); 
        self.__index = self; 
        class.weaponMngr.__index = class.weaponMngr; 
         
        class.name = getElementData( classElement, "name" ); 
         
        local classData = getElementChildren( classElement ); 
        for _, data in ipairs( classData ) do 
         
            if getElementType( data ) == "info" then 
                class.info = getElementData( data, "text" ); 
                 
            elseif getElementType( data ) == "color" then 
                class.color.red =   tonumber( 0 and getElementData( data, "red" ) or 255 ); 
                class.color.green = tonumber( 0 and getElementData( data, "green" ) or 255 ); 
                class.color.blue =  tonumber( 0 and getElementData( data, "blue" ) or 255 ); 
                 
            elseif getElementType( data ) == "skin" then 
                class.skinMngr:AddSkin( data ); 
                 
            elseif getElementType( data ) == "weapon" then 
                class.weaponMngr:AddWeapon( data ); 
                 
            elseif getElementType( data ) == "camera" then 
                local camChildren = getElementChildren( data ); 
                for _, camInfo in ipairs( camChildren ) do 
                    if getElementType( camInfo ) == "position" then 
                        class.cameraMngr:Position( camInfo ); 
                    elseif getElementType( camInfo ) == "lookAt" then 
                        class.cameraMngr:LookAt( camInfo ); 
                    end 
                end 
                 
            end 
        end 
        return class; 
    end 
    return false; 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
CameraManager = { }; 
CameraManager.__index = CameraManager; 
  
function CameraManager: New( ) 
    local cameramngr = { 
        pos = { }, 
        lookAt = { }, 
    }; 
    setmetatable( cameramngr, self ); 
    self.__index = self; 
    return cameramngr; 
end 
  
function CameraManager: Position( cameraPosElement ) 
    if cameraPosElement then 
        self.pos.x = tonumber( getElementData( cameraPosElement, "x" ) ); 
        self.pos.y = tonumber( getElementData( cameraPosElement, "y" ) ); 
        self.pos.z = tonumber( getElementData( cameraPosElement, "z" ) ); 
    else 
        return self.pos.x, self.pos.y, self.pos.z; 
    end 
end 
  
function CameraManager: LookAt( cameraLookAtElement ) 
    if cameraLookAtElement then 
        self.lookAt.x = tonumber( getElementData( cameraLookAtElement, "x" ) ); 
        self.lookAt.y = tonumber( getElementData( cameraLookAtElement, "y" ) ); 
        self.lookAt.z = tonumber( getElementData( cameraLookAtElement, "z" ) ); 
    else 
        return self.lookAt.x, self.lookAt.y, self.lookAt.z; 
    end 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
Skin = { }; 
Skin.__index = Skin; 
  
function Skin: New( skinElement ) 
    local skin = { 
        name = "", 
        modelId = 0, 
        weaponMngr = WeaponManager:New( ), 
        spawnLoc = { x, y, z }, 
    } 
    if getElementType( skinElement ) == "skin" then 
        setmetatable( skin, self ); 
        self.__index = self; 
         
        --setmetatable( skin.weaponMngr, WeaponManager ); 
        skin.weaponMngr.__index = skin.weaponMngr; 
         
        skin.name = getElementData( skinElement, "name" ); 
        skin.modelId = getElementData( skinElement, "id" ); 
         
        local children = getElementChildren( skinElement ); 
        for _, child in ipairs( children ) do 
            if getElementType( child ) == "spawnpoint" then 
                skin.spawnLoc.x = tonumber( getElementData( child, "x" ) ); 
                skin.spawnLoc.y = tonumber( getElementData( child, "y" ) ); 
                skin.spawnLoc.z = tonumber( getElementData( child, "z" ) ); 
                skin.spawnLoc.rot = tonumber( getElementData( child, "rot" ) ); 
            elseif getElementType( child ) == "weapon" then 
                skin.weaponMngr:AddWeapon( child ); 
            end 
        end 
        return skin; 
    end 
    return false; 
end 
  
function Skin: GetSpawnPosition( ) 
    return self.spawnLoc.x, self.spawnLoc.y, self.spawnLoc.z; 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
SkinManager = { }; 
SkinManager.__index = SkinManager; 
  
function SkinManager: New( ) 
    local skinmngr = { 
        skins = { }, 
    }; 
    setmetatable( skinmngr, self ); 
    self.__index = self; 
    return skinmngr; 
end 
  
function SkinManager: AddSkin( skinElement ) 
    table.insert( self.skins, Skin:New( skinElement ) ); 
end 
  
function SkinManager: GetSkins( ) 
    return self.skins; 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
Weapon = { }; 
Weapon.__index = Weapon; 
  
function Weapon: New( weaponElement ) 
    local weapon = { 
        id = 0, 
        ammo = 0, 
    }; 
    if getElementType( weaponElement ) == "weapon" then 
        setmetatable( weapon, self ); 
        self.__index = self; 
        weapon.id = tonumber( getElementData( weaponElement, "id" ) ); 
        weapon.ammo = tonumber( getElementData( weaponElement, "ammo" ) ); 
        return weapon; 
    end 
    return false; 
end 
  
--[[================================================================================]]-- 
--[[================================================================================]]-- 
  
  
WeaponManager = { }; 
WeaponManager.__index = WeaponManager; 
  
function WeaponManager: New( ) 
    local weaponmngr = { 
        weapons = { }, 
    }; 
    setmetatable( weaponmngr, self ); 
    self.__index = self; 
    return weaponmngr; 
end 
  
function WeaponManager: AddWeapon( weaponElement ) 
    table.insert( self.weapons, Weapon:New( weaponElement ) ); 
end 
  
function WeaponManager: GetWeapons( ) 
    local weapons = { }; 
    for i, weapon in ipairs( self.weapons ) do 
        weapons[ i ] = { }; 
        weapons[ i ].id = weapon.id; 
        weapons[ i ].ammo = weapon.ammo; 
    end 
    return weapons; 
end 
  
function WeaponManager: WeaponCount( ) 
    return #self.weapons; 
end 

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