Jump to content

Commands won't show


Recommended Posts

Posted

In game, these two commands when entered will not show up:

function giveKey(player,command,arg) 
local playera = getPlayerFromPartOfName ( arg ) 
if playera then 
local myAccount = getPlayerAccount(player) 
local myAccountName = getAccountName(myAccount) 
local account = getPlayerAccount(playera) 
setAccountData ( account,"key"..myAccountName,true) 
outputChatBox("You have given a key to"..getPlayerName(playera),player) 
else 
outputChatBox("Cannot find player, make sure you use /giveKey 'player'") 
end 
end 
  
addCommandHandler ( "giveKey", giveKey ) 
  
function removeKey(player,command,arg) 
local playera = getPlayerFromPartOfName ( arg ) 
if playera then 
local myAccount = getPlayerAccount(player) 
local myAccountName = getAccountName(myAccount) 
local account = getPlayerAccount(playera) 
setAccountData ( account,"key"..myAccountName,false) 
outputChatBox("You have removed a key to"..getPlayerName(playera),player) 
else 
outputChatBox("Cannot find player, make sure you use /revokeKey 'player'") 
end 
end 
  
addCommandHandler ( "revokeKey", removeKey ) 

Why? There are no errors within the control panel.

Posted

Try this should work

function giveKey(player,command,arg) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        local myAccountName = getAccountName(account) 
        if arg then 
            local playera = getPlayerFromName ( arg ) 
            if playera then 
                local pAccount = getPlayerAccount(playera) 
                setAccountData (pAccount,"key"..myAccountName,true) 
                outputChatBox("You have given a key to"..getPlayerName(playera),player) 
            else 
                outputChatBox("Cannot find player, make sure you use /giveKey 'player'") 
            end 
        end  
    end  
end 
addCommandHandler ( "giveKey", giveKey ) 
  
function removeKey(player,command,arg) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        local myAccountName = getAccountName(account) 
        if arg then  
            local playera = getPlayerFromPartOfName ( arg ) 
            if playera then 
                local pAccount = getPlayerAccount(playera) 
                setAccountData (pAccount,"key"..myAccountName,false) 
                outputChatBox("You have removed a key to"..getPlayerName(playera),player) 
            else 
                outputChatBox("Cannot find player, make sure you use /revokeKey 'player'") 
            end  
        end 
    end  
end 
addCommandHandler ( "revokeKey", removeKey ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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