Jump to content

help. Command no works!


Recommended Posts

why not work?

function giveitem(playerSource, commandName, thegived, item, n) 
    local accName = getAccountName ( getPlayerAccount (playerSource) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if ( thegived and item and n ) then 
            local namegived = getPlayerFromName(thegived) 
            setElementData (namegived, item, n ) 
            --outputChatBox ( "#ffffffYou gave #ff0000"..item.."#ffffff("..n..")for #ff0000"..getPlayerName(namegived).."!", playerSource, 255, 255, 255, true ) 
            --outputChatBox ( "#ffffffYou won#ff0000 "..item.."#ffffff("..n..") of #ff0000"..getPlayerName(playerSource).."!", namegived, 255, 255, 255, true ) 
        else 
            outputChatBox ( "Correct: #FFFFFF/give Name Item Value", playerSource, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler ( "give", giveitem ) 

example usage in game:

setElementData (getPlayerFromName("NICK"), "iten", n )

  
setElementData (getPlayerFromName("NICK"), "MAX_Slots", 30 ) 
  

Link to comment

Try this:

function giveitem(playerSource, commandName, thegived, item, n) 
    local accName = getAccountName ( getPlayerAccount (playerSource) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        if ( thegived and item and n ) then 
            local namegived = getPlayerFromName(thegived) 
            setElementData (namegived, tostring(item), tostring(n) ) 
            --outputChatBox ( "#ffffffYou gave #ff0000"..item.."#ffffff("..n..")for #ff0000"..getPlayerName(namegived).."!", playerSource, 255, 255, 255, true ) 
            --outputChatBox ( "#ffffffYou won#ff0000 "..item.."#ffffff("..n..") of #ff0000"..getPlayerName(playerSource).."!", namegived, 255, 255, 255, true ) 
        else 
            outputChatBox ( "Correct: #FFFFFF/give Name Item Value", playerSource, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler ( "give", giveitem ) 

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