ULX

Author Topic: Custom ulx command  (Read 3746 times)

0 Members and 1 Guest are viewing this topic.

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Custom ulx command
« on: May 06, 2016, 04:00:10 PM »
Hello, people sorry to ask for this. I know it happens a lot...
So that what brings me here : I'm trying to make a ulx votecleanup for props with game.CleanUpMap
so that what I did for now but I don't know how Ulx commands works so much so I was wondering : could you help me please ?
Thank you for everything,
Reese
« Last Edit: May 09, 2016, 09:45:51 AM by Reese »

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Custom ulx command
« Reply #1 on: May 06, 2016, 07:12:08 PM »
As for most problems that involve code (any problem, really), it's very helpful to the people trying to help you if you tell us what you expected your code to do, and what it's doing instead. Also list any errors you're getting. The less effort we have to put in, the more likely you're to get a response from us.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #2 on: May 07, 2016, 02:02:30 AM »
Oh sorry vote that I want a Ulx command that if most of players agree with a vote the map cleans up. The only error I get isn't a real one but "attempt to call a nil value"(serverside) with no other information.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Custom ulx command
« Reply #3 on: May 07, 2016, 07:26:05 AM »
Reese, that is indeed a real error that would help you if you knew how to read it.
Can you copy paste the exact error for us?
It also includes line numbers and often function trace backs.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #4 on: May 07, 2016, 08:24:41 AM »
It is exactly all what is saying in the console no function no lines. Like I said no other informations but it's serverside

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Custom ulx command
« Reply #5 on: May 07, 2016, 04:56:22 PM »
Garry's Mod will not give a lua error without a trace to the file (and possibly functions) that it originated from. Unless you have another addon that is hijacking error messages (I know DarkRP gives error messages for its files, but I'm not sure if it does/can block the default error messages) then you should have this information. Make sure you check the server console as well, not just your client's.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #6 on: May 08, 2016, 12:28:46 AM »
It's on a singleplayermod so clientside and serverside console but it is right that the addon DarkRP is creating errors on the singleplayer. I'm gonna try my code on sandbox and tell you more details.
By the way, thank you for helping me all of you

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #7 on: May 08, 2016, 10:13:20 AM »
"-You started a cleanup vote for Reasons
-attempt to call a nil value"
Yep nothing changes
You have some kind of teamspeack ?
« Last Edit: May 08, 2016, 10:33:50 AM by Reese »

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Custom ulx command
« Reply #8 on: May 08, 2016, 11:55:27 AM »
ulx.doVote will print "attempt to call a nil value" if the voting callback function is not defined. No stack trace because the callback is not called directly, but via ULib.pcallError.

Simply declare your voting callback before your command callback to fix this. :)
« Last Edit: May 08, 2016, 12:21:46 PM by Timmy »

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #9 on: May 08, 2016, 01:51:13 PM »
Thank you gonna try this now
EDIT : works thanks ! could you help me to make a cooldown of this command ?
« Last Edit: May 08, 2016, 02:20:11 PM by Reese »

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Custom ulx command
« Reply #10 on: May 09, 2016, 05:13:06 AM »
I thought ULX had a default command with a cooldown, but I can't for the life of me remember which one.

If nobody has answered your question by later today, I'll come back and either find that default ULX command or dig out an old command of mine with a cooldown.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Custom ulx command
« Reply #11 on: May 09, 2016, 09:31:32 AM »
I thought ULX had a default command with a cooldown, but I can't for the life of me remember which one.
Correct! The votemap command does have a cooldown feature. https://github.com/TeamUlysses/ulx/blob/0db8007ceb4a49e22c2bb191d1e16d423851f21e/lua/ulx/modules/votemap.lua
« Last Edit: May 09, 2016, 09:43:02 AM by Timmy »

Offline Reese

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
Re: Custom ulx command
« Reply #12 on: May 09, 2016, 09:45:28 AM »
Thank you all I'm will close this thread thank you really

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Custom ulx command
« Reply #13 on: May 09, 2016, 12:04:30 PM »
Timmy saves the day!

*applause*
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.