Author Topic: Help with making an addon use IP.  (Read 420 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." );

ML:AddCredits( target_ply, amount );
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i credits", target_ply, amount );
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: 7951
  • Karma: 373
  • 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.
The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side. - James Baldwin

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1264
  • Karma: 166
  • open(my $file, "<README") or die;
    • XGUI
"The stupidity of an individual on the Internet is generally matched only the by size of their ego, unless the individual in question is unaware of both." - Me