Jump to content

Script bad argument ?


tim260

Recommended Posts

function checkClass(hitElement, matchingDimension) 
  
    if ( getElementType(hitElement) == "vehicle" ) then 
        hitElement = getVehicleController(hitElement) 
    end 
  
    for i=0,#gateList do  
        local name = getTeamName(getPlayerTeam(hitElement)) 
        if(name == false) then 
            name = "false" 
        end 
        if ( name == team[i] or name == "false") then  
            detection = isElementWithinColShape ( hitElement, shapes[i] ) 
            if detection == true then  
                move(i, false) 
            end 
        end 
    end 
end 

thats the script but it really says that the getteamname is wrong in the server :D

Bad argument @ `getTeamName` 

Link to comment
function checkClass(hitElement, matchingDimension)  
    if ( getElementType(hitElement) == "vehicle" ) then 
        hitElement = getVehicleController(hitElement) 
    end 
  
    for i=0,#gateList do 
        if not getPlayerTeam(hitElement) then return end 
        local name = getTeamName(getPlayerTeam(hitElement)) 
        if(name == false) then 
            name = "false" 
        end 
        if ( name == team[i] or name == "false") then 
            detection = isElementWithinColShape ( hitElement, shapes[i] ) 
            if detection == true then 
                move(i, false) 
            end 
        end 
    end 
end 

Try that.

Link to comment
function checkClass(hitElement, matchingDimension)  
    if ( getElementType(hitElement) == "vehicle" ) then 
        hitElement = getVehicleController(hitElement) 
    end 
    if not isElement(hitElement) then return end  
  
    for i=0,#gateList do 
        if not getPlayerTeam(hitElement) then return end 
        local name = getTeamName(getPlayerTeam(hitElement)) 
        if(name == false) then 
            name = "false" 
        end 
        if ( name == team[i] or name == "false") then 
            detection = isElementWithinColShape ( hitElement, shapes[i] ) 
            if detection == true then 
                move(i, false) 
            end 
        end 
    end 
end 

Try that.

Link to comment

Thanks TAPL :D

This is the code ? :D so i see there is written teamAdmmin with 2 "m" is that correct

function createTeamsOnStart () 
    teamAdmmin = createTeam ( "Admin", 0, 255, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) 
  
local root = getRootElement() 
  
addEventHandler("onPlayerLogin", root 
if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
local theTeam = getPlayerTeam ( source ) 
  if theTeam then                       
    setPlayerTeam ( source, Admin ) 
  end 
end 

Link to comment
  • Discord Moderators

Really buggy. Look at line 8 and on, does this look correct to you?

Also if you define teamAdmmin, but you tell the script to get Admin, how is it supposed to work?

function createTeamsOnStart () 
    teamAdmmin = createTeam ( "Admin", 0, 255, 0 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) 
  
local root = getRootElement() 
  
addEventHandler("onPlayerLogin", root, 
    function (_, account) 
        if isObjectInACLGroup ("user." .. getAccountName(account), aclGetGroup("Admin" )) then                   
            setPlayerTeam (source, teamAdmmin) 
        end 
    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...