ULX

Author Topic: Help with making an addon use IP.  (Read 1944 times)

0 Members and 1 Guest are viewing this topic.

Offline kwinkywolf

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Help with making an addon use IP.
« on: June 14, 2018, 05:21:17 AM »
Hello to whomever it may concern,

I have here an addon for an F3 menu, and i'm hoping to make it so that SDonate can be used to add a certain amount of credits to the user's credit amount. The only way I can see to do that, is by using a cvar. Now, I used the ulx addcredits command, but this would only work with the player's nickname in that server, and SDonate can only output steam names and Steam IDs.

So, what I planned to do was either make a new command just for doing the same thing with the ID, or to make the current one there compatible with Steam IDs.

If anybody could help me out, it'd be much much appreciated. I'm brand new to Ulysses, and still fairly new to Lua coding with only having a few addons i've made.

Current AddCredits command code:

Code: [Select]
function ulx.addCredits( calling_ply, target_ply, amount )
if( type( amount ) != "number" ) then
calling_ply:ChatPrint( "Invalid amount! Only a number." );
return;
end

ML:AddCredits( target_ply, amount );
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i credits", target_ply, amount );
end
local addCredits = ulx.command( CATEGORY_NAME, "ulx addcredits", ulx.addCredits, "!addcredits" )
addCredits:addParam{ type=ULib.cmds.PlayerArg };
addCredits:addParam{ type=ULib.cmds.NumArg, hint="credits" };
addCredits:defaultAccess( ULib.ACCESS_ADMIN );
addCredits:help( "Add to the F3 credits of a user(you can use negative amounts like -100)." );

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Help with making an addon use IP.
« Reply #1 on: June 15, 2018, 05:45:30 PM »
ULib.cmds.PlayerArg Already takes SteamIds.
ML:AddCredits is your function needing edit.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6