Jump to content

Commands


eduher

Recommended Posts

Posted

Hello who can tell me what I can function How to use DOS command to run into one of

EXAMPLE :

I have two commands

A command ( run a function)

B command (executes another function )

But I want a C- command run the A and B Command could help someone :roll:

Posted

Server.lua -

function functionA(player,cmd) 
end 
  
function functionB(player,cmd) 
end 
  
addCommandHandler("testa",functionA) 
addCommandHandler("testb",functionB) 
addCommandHandler("testc",{functionA,functionB}) 

Like Cody said, but you need the player,cmd inside of () on function - IF SERVERSIDE, if its clientside then just cmd inside ()

Client.lua -

function functionA(cmd) 
end 
  
function functionB(cmd) 
end 
  
addCommandHandler("testa",functionA) 
addCommandHandler("testb",functionB) 
addCommandHandler("testc",{functionA,functionB}) 

~ Shaio Fencski

n-560x95_FFFFFF_FFFFFF_000000_000000.png
Posted

@Codyl , What's this ???? you need to added the function name not a table.

f19af561db.png

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

Posted
@Codyl , What's this ???? you need to added the function name not a table.

f19af561db.png

I think id need to run tests, but i belive this should work due to how lua works.

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
@Walid Saw it in a script a while back that I was fixing, it gave no errors and worked.

Try it by yourself and post the code here.

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

Posted

That's odd, I know for a fact I've seen it used before, and it for sure worked. Maybe I just have wrong format.

    addCommandHandler("testa",testfunction) 
    addCommandHandler("testb",testfunction2) 
    addCommandHandler("testc",testfunction) 
    addCommandHandler("testc",testfunction2) 

but try that I guess.

Wolf Inc Discord

Youtube channel
Github

Posted
That's odd, I know for a fact I've seen it used before, and it for sure worked. Maybe I just have wrong format.

It's very simple it can be like this:

Method 1:

-- function A 
function functionA(player,cmd) 
   outputChatBox("test A command",player) 
end 
addCommandHandler("testa",functionA) 
  
-- function B 
function functionB(player,cmd) 
    outputChatBox("test B command",player) 
end 
addCommandHandler("testb",functionB) 
  
local functions = {functionA,functionB} 
  
for i,v in pairs(functions) do 
    addCommandHandler("testc",v) 
end 

Method 2:

function allfunctions(player,cmd) 
    if cmd == "testa" then  
        -- testa code here 
    elseif cmd == "testb" then 
        -- testb code here 
    elseif cmd == "testc" 
        -- testa code here 
        -- testb code here 
    end  
end 
addCommandHandler("testa",allfunctions) 
addCommandHandler("testb",allfunctions) 
addCommandHandler("testc",allfunctions) 

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