Author Topic: Help with permamute?  (Read 4072 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Help with permamute?
« Reply #15 on: May 17, 2016, 03:43:16 AM »
What's happening is that console is always an invalid entity and GetPData can not be passed to it. Basically all you need to do is check if the "talker" is valid.

if IsValid(talker) and talker:GetPData( "permmuted" ) == "true" then ... end

Also not sure if you should add talker.GetPData to be extra safe but just so you can see both variations...

if IsValid(talker) and talker.GetPData and talker:GetPData( "permmuted" ) == "true" then ... end

Line 35 in your paste, line 147 in the console error.



Also to help you understand lua errors better, errors will usually look like this...

[ERROR] path/to/file.lua:line: Description
Everything underneath this line are other errors that happened because of the main error above.

This is the path to the file, aka. where the file is.
The files name, what it's called.
On what line of the file the error happened, this will help you find exactly what part of your code the error happens on. (You will see line numbers in editors like Notepad++, Sublime Text, etc.)
The description tells you what went wrong, "a nil value" means that a value was not found or returned nothing when your code was expecting something.

All right. I'll tell him to add that in. Can I ask why you need to have "IsValid( talker ) and talker.GetPData"? Like what I mean is what's the point of adding that GetPData?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.