General > Developers Corner
Help again with RunConsoleCommand
[TBR] Lt Usher:
it's kicking an error
--- Code: ---[ERROR] addons/ulx/lua/ulx/modules/sh/dayzbank.lua:42: attempt to call field 'SendToServer' (a nil value)
[ERROR] addons/ulx/lua/ulx/modules/sh/dayzbank.lua:73: attempt to call field 'SendToServer' (a nil value)
--- End code ---
bender180:
--- Quote from: [TBR] Lt Usher on December 30, 2014, 04:55:32 AM ---it's kicking an error
--- Code: ---[ERROR] addons/ulx/lua/ulx/modules/sh/dayzbank.lua:42: attempt to call field 'SendToServer' (a nil value)
[ERROR] addons/ulx/lua/ulx/modules/sh/dayzbank.lua:73: attempt to call field 'SendToServer' (a nil value)
--- End code ---
--- End quote ---
The issue here is that you haven't defined SendToServer as anything its a nil value it does nothing and it always will do nothing until you define it to do something.
Bytewave:
--- Quote from: bender180 on December 30, 2014, 01:39:29 PM ---The issue here is that you haven't defined SendToServer as anything its a nil value it does nothing and it always will do nothing until you define it to do something.
--- End quote ---
http://wiki.garrysmod.com/page/net/SendToServer
Is that even the addon code I sent? 'Cause that code calls SendToServer on 29 and 60.
[TBR] Lt Usher:
Yep it's deffinatly the same code and I'm not sure why it's pulling a nill value
[TBR] Lt Usher:
nope the new code doesn't work either
--- Code: ---local CATEGORY_NAME = "Day-Z Bank Admin"
local gamemode_error = "The current gamemode is not Gmod Day-Z!"
------------------------------ Give Credits ------------------------------
function ulx.givecredits( calling_ply, target_plys, credits )
if not GetConVarString("gamemode") == "dayz" then
ULib.tsayError( calling_ply, gamemode_error, true )
else
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
local steamid = v:SteamID()
local ccstring = ("dz_giveitemid ".. steamid .." item_credits ".. credits .."\n")
if SERVER then
game.ConsoleCommand( ccstring )
end
table.insert( affected_plys, v )
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i credit(s)", affected_plys, credits )
end
end
local givecredit = ulx.command( CATEGORY_NAME, "ulx givecredits", ulx.givecredits, "!givecredits" )
givecredit:addParam{ type=ULib.cmds.PlayersArg }
givecredit:addParam{ type=ULib.cmds.NumArg, hint = "credits", min = 1, default = 1 }
givecredit:defaultAccess( ULib.ACCESS_ADMIN )
givecredit:help( "Gives credits to players." )
------------------------------ Give Money ------------------------------
function ulx.givemoney( calling_ply, target_plys, money )
if not GetConVarString("gamemode") == "dayz" then
ULib.tsayError( calling_ply, gamemode_error, true )
else
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
local steamid = v:SteamID()
local ccstring = "dz_giveitemid ".. steamid .." item_money ".. money .."\n"
if SERVER then
game.ConsoleCommand( ccstring )
end
table.insert( affected_plys, v )
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i money", affected_plys, money )
end
end
local givemoney = ulx.command( CATEGORY_NAME, "ulx givemoney", ulx.givemoney, "!givemoney" )
givemoney:addParam{ type = ULib.cmds.PlayersArg }
givemoney:addParam{ type = ULib.cmds.NumArg, hint = "money", min = 1, default = 1 }
givemoney:defaultAccess( ULib.ACCESS_ADMIN )
givemoney:help( "Gives money to players." )
--- End code ---
Error:
--- Code: ---Bad SetLocalOrigin(13963.000000,19502.000000,34.000000) on gmod_hands (602)
[TBR] Lt Usher gave Themself 1 credit(s)
ServerLog: [ULX] [TBR] Lt Usher gave Themself 1 credit(s)
Player STEAM_0 doesn't exist in the database! They've never joined the server!
--- End code ---
From what I can make of it is the steam id is not infilling in full please help!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version