Would This Code Work?

Hello everyone, so I’m editing some code in Dr. Newjorciks’ Suggestion addon. I was wondering if this code would work:



if ply:IsAdmin() then
	Suggestions.ChatNotifyText = "%s is checking suggestions by typing '!suggest' or pressing F6."
end


Test it yourself instead of being lazy?

[editline]25th July 2015[/editline]

And no

Could you be constructive, instead of just say no and criticizing the fact that I asked for support?

I’m away from my main computer, I cannot test it.

“No” because you have a syntax error on the first line (you’re missing parentheses).

I see, thank you.



if ply:IsAdmin() then
	Suggestions.ChatNotifyText = "%s is checking suggestions by typing '!suggest' or pressing F6."
end


Would that work?

  1. ply:IsAdmin is missing the ‘()’ - it is a method. ply:IsAdmin()
  2. Where is this code located? It will need to be in a hook where ply is defined. You will also need it to be in a hook where it can change back if the player is not an admin.
  3. I don’t know how that script you bought works, but is Suggestions.ChatNotifyText a function or an indexed string? If it is a function, you also need () and you will most likely want the text inside that as an argument. If it is an indexed string, you will need to dynamically change it back and forth when players are not admins; not just change it once.
  1. Yeah, fixed that. Post is updated.
  2. Finding out now exactly what a hook is. Really new to Lua.
  3. Finding that out.

Then you should update your posts with the updated code otherwise people will just point it out over and over again.

Yeah, I updated it.

You haven’t, you’ve been told that it’s ply:IsAdmin(), not ply:IsAdmin.

Yeah, like I said I’m really new so I didn’t know it came after ply:IsAdmin, I thought ply:IsAdmin was wrapped in parenthesis, instead.