Jump to content

Command


Msypon

Recommended Posts

script doesn't make any sense at all. as even table is wrong:

Table should look like this:

local commands = 
{ 
      {'hi'} = true, 
      {'oh'} = true; 
}; 

The script didn't define 'cmd' appropriately, it defined it as a function command (( That's what i get mostly when i don't define it appropriately ))

P.S. Not sure about the rest of script as i am tired

Edited by Guest
Link to comment

How is the table wrong? The table has no syntax error.

@Msypon, the script isn't working because what you are doing in the if statement is comparing "cmd" string with the called index from 'commands' table but your table is number-indexed. The table below is how it should be:

local g_pCommands = 
{ 
    [ "hi" ] = true, 
    [ "oh" ] = true; 
}; 

You should also check if there is an index with same string chars as "cmd", not check if "cmd" is equal to "commands[cmd]":

if ( commands[cmd] ) then 

By the way, use local variables the more you can.

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