I have a couple of questions about GMod specific Lua. (Lua in general I get for the most part)
If you can answer one or all of my questions it would be much appreciated.
It would be better if you could explain the answer to my question. Examples help but I’d like to learn how everything works, not just copy paste.
1: Can someone please explain to me how to make the server do an action on the player.
In example: If I want the server to give the player a weapon, or set his/her health. How would that be
done? I know it has somthing to do with this pl:(function) I see in nearly every lua file I see, but I have
no idea what that means or how it works.
2: Relating to question 1, What is this pl (I’ve seen it used as ply before), before many functions. I’ve
tried doing similar things but can never seem to get them to work. How does it work? When should I
use it? etc…
3: If a client calls a command that gives them a weapon or sets their health or somthing of such, will
everyone else be able to see said weapon or health change? It was triggered on the client which is all
local so wouldn’t that mean that the health or weapon would just be for said client to see?
4: Can I set/check a global variable from a client-side file?
More Detail: Let’s say I have a table and in which is an entry for each player that will in theory keep
track of the players money. Will I be able to set/check the value that is on the server side from the
client? So that if the value for said player is not high enough, they won’t be able to complete an action?
5: Relating to question, Is there a better way to keep track of a value for a certain player? Better then
assigning a player a certain entry in a table then altering it as he/she completes or fails certain actions.
Sorry for all the questions, but I’m trying my best to learn, and I can’t progress too much farther without figuring these things out.