So I'm trying to make a command in ULX which will bring up a player's sourcebans ban history on my server. This is what I have so far, but I'm getting some errors.
[lua]local CATEGORY_NAME = "Utility"
function ulx.po( calling_ply , target_plys )
local target_plys = v
local v:SteamID() = steamid
if v:IsValid() = true then
calling_ply:SendLua([[gui.OpenURL("http://bans.carbonitegaming.site.nfoservers.com/index.php?p=banlist&searchText="..steamid.."&Submit")]])
else
ULib.tsayError( calling_ply, "That player is not on the server. Try searching by steamid." true )
end
local po = ulx.command( CATEGORY_NAME, "ulx po", ulx.po )
po:defaultAccess( ULib.ACCESS_ALL )
po:help( "Check a player's previous bans." )[/lua]
Error:
[code]
[ERROR] addons/ulx/lua/ulx/modules/sh/po.lua:5: unexpected symbol near ':'
1. unknown - addons/ulx/lua/ulx/modules/sh/po.lua:0
[/code]
change
[LUA]local v:SteamID() = steamid[/LUA]
to
[LUA]local steamid = v:SteamID()[/LUA]
also you do
[LUA]IsValid( v )[/LUA]
instead of
[LUA]v:IsValid() = true[/LUA]
Changed it around like you said I should. Now getting this error.
[code][ERROR] addons/ulx/lua/ulx/modules/sh/po.lua:7: function arguments expected near 'if'
1. unknown - addons/ulx/lua/ulx/modules/sh/po.lua:0
[/code]
Current code:
[lua]local CATEGORY_NAME = "Utility"
function ulx.po( calling_ply , target_plys )
local v = target_plys
local steamid = v:SteamID
if IsValid( v ) then
v:SendLua([[gui.OpenURL("http://bans.carbonitegaming.site.nfoservers.com/index.php?p=banlist&searchText="..steamid.."&Submit")]])
else
ULib.tsayError( calling_ply, "That player is not on the server. Try searching by steamid." true )
end
end
local po = ulx.command( CATEGORY_NAME, "ulx po", ulx.po )
po:defaultAccess( ULib.ACCESS_ALL )
po:help( "Check a player's previous bans." )[/lua]
v:SteamID() not v:SteamID.
SteamID() is a function.
[QUOTE=Internet1001;42733799]v:SteamID() not v:SteamID.
SteamID() is a function.[/QUOTE]
Can't believe I missed that. Got it working now. Thanks for all the help.
Sorry, you need to Log In to post a reply to this thread.