Could someone help me out with this custom ulx command ive been trying to make? It won't appear in my ulx menu after restarts so I assume I'm overlooking something important. I referenced the preexisting ulx commands but still no luck. Thanks for your time :)
[CODE]
local CATEGORY_NAME = "Playtime"
----------------------Playtime---------------------------
function ulx.playtime( calling_ply, target_plys, amount )
for i=1, #target_plys do
local v = target_plys[ i ]
v:AddRankPT( amount )
end
DarkRP.notify( target_plys, 0, 4, calling_ply:Nick() .. " gave you "..amount.."XP" )
ulx.fancyLogAdmin( calling_ply, .. ' gave '..target_plys..' '..amount.."XP" )
end
local playtime = ulx.command( CATEGORY_NAME, "ulx playtime", ulx.playtime, "!playtime" )
playtime:addParam{ type=ULib.cmds.PlayerArg }
playtime:addParam{ type=ULib.cmds.NumArg, min=0, max=100000, ULib.cmds.round }
playtime:defaultAccess( ULib.ACCESS_ADMIN )
playtime:help( "Give Playtime to a player." )
---------------------- Promote ---------------------------------
function ulx.promote( calling_ply, target_plys)
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true )
else
v:TimeUntilPromo() = ptime
v:AddRankPT( ptime )
end
DarkRP.notify( target_plys, 0, 4, calling_ply:Nick() .. " promoted you to "..target_plys:GetJobRankPrefix() )
ulx.fancyLogAdmin( calling_ply:Nick() .. ' promoted '..target_plys:Nick()..' to '..target_plys:GetJobRankPrefix() )
end
local promote = ulx.command( CATEGORY_NAME, "ulx promote", ulx.promote, "!promote" )
promote:addParam{ type=ULib.cmds.PlayerArg }
promote:defaultAccess( ULib.ACCESS_ADMIN )
promote:help( "Promote a player." )
[/CODE]
Is it run client side and serverside?
I put it in the sh folder if that answers your question? Sorry I'm very new to this
[code]
ulx.fancyLogAdmin( calling_ply, .. ' gave '..target_plys..' '..amount.."XP" )
[/code]
This line starts a very long string, according to the code window.
[QUOTE][IMG]http://i.imgur.com/ufg0B1d.png[/IMG][/QUOTE]
Remove the " before XP.
[editline]18th January 2017[/editline]
Nevermind, may be wrong looking at it further.
Coders here specialize in general Lua/Garry's Mod extended Lua.
You'd probably have better luck [url=http://forums.ulyssesmod.net/]here[/url]
you can't concatenate userdata values
This is nasty...
[CODE]ulx.fancyLogAdmin (calling_ply, '#A gave #T %s XP', target_plys, amount)[/CODE]
[CODE]ulx.fancyLogAdmin( calling_ply, .. ' gave '..target_plys..' '..amount.."XP" )[/CODE]
Sorry, you need to Log In to post a reply to this thread.