Ulysses

General => Developers Corner => Topic started by: kwinkywolf on June 14, 2018, 05:21:17 AM

Title: Help with making an addon use IP.
Post by: kwinkywolf 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)." );
Title: Re: Help with making an addon use IP.
Post by: JamminR on June 15, 2018, 05:45:30 PM
ULib.cmds.PlayerArg Already takes SteamIds.
ML:AddCredits is your function needing edit.
Title: Re: Help with making an addon use IP.
Post by: Stickly Man! on June 18, 2018, 08:46:16 AM
Posting for reference:
https://gmod.facepunch.com/f/gmoddev/bszna/ULX-Help-with-changing-convar-to-use-IP/1/