• Print

Author Topic: Multiple function calls in a ulx command doesn't work.  (Read 4323 times)

0 Members and 1 Guest are viewing this topic.

Offline Rex744

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Multiple function calls in a ulx command doesn't work.
« on: April 10, 2017, 12:20:03 pm »
The rest of the code above doesn't matter, just imagine a ulx custom command that has two if statements, if something then Easy() and if something then Medium(), the only thing that works is the first function which is Easy()
Example below:

Code: [Select]
function Easy()
RunConsoleCommand("Say","e")
end

 function Medium()
RunConsoleCommand("Say","e")
end

local example = ulx.command( "Voting", "ulx example"} )
example:help( "example" )
example:defaultAccess( ULib.ACCESS_ADMIN )

I need help getting passed this issue.

EDIT: I forgot to include elseif I just did a bunch of if statements.
« Last Edit: April 10, 2017, 02:46:18 pm by Rex744 »

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Multiple function calls in a ulx command doesn't work.
« Reply #1 on: April 10, 2017, 01:11:15 pm »
Code: Lua
  1.        if winningOptionName == "Easy" then Mediums()
  2.             if winningOptionName == "Medium" then Mediums()
  3.             if winningOptionName == "Hard" then Hards()
  4.             if winningOptionName == "Insane" then Insanes


You never ended these if statements when they should've been. Use elseifs.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

  • Print