I have a simple module wherein I use the team.GetName() function. This works perfectly on my own local machine, but when I upload it to my server, it gives me the following error: [url]http://i.imgur.com/Debe5r3.png[/url]
Here is the code that causes the trouble:
[CODE]hook.Add("ULibCommandCalled", "restrict command usage when not admin job", function(ply, commandName, args)
if team.GetName(ply:Team()) == cfg_admindutyjob or team.GetName(ply:Team()) == cfg_moddutyjob or ply:CheckGroup(cfg_immunityrank) then
return true
end
for _,v in pairs(cfg_whitelistcommands) do
if string.StartWith(commandName,v) then
return true
end
end
ply:ChatPrint("You cannot execute the following command while roleplaying:")
return false
end)[/CODE]
I have no clue why the error only occurs on the dedicated server, I was hoping someone out here might know.
It works perfectly fine when I test it myself on a listen server.
Any help is appreciated :D
ply can be nil.
You are comapring a string returned by team.GetName with a nil variable.
Add IsValid(ply) check, make sure the hook parameters are actually correct.
Sorry, you need to Log In to post a reply to this thread.