Difference between pl, ply, and LocalClient()

Could someone tell me the difference between pl, ply, and LocalClient()?
I could not find any info on this on google or the old gmod wiki. Pl and ply look similar but I know that they are not the same thing.
I would be really happy if someone could tell me the difference.

pl and ply are variables. People just normally use “pl” or “ply” when making variables that hold player objects. It’s become a habit (a good habit).

LocalClient() doesn’t exist. Do you mean LocalPlayer()? LocalPlayer() is a clientside function that gets the player object.

Yes, I did mean LocalPlayer() and thanks for replying but what is the difference between pl and ply?

one is missing a y

More seriously… If you don’t know what a variable is, read this

I know what a variable is I just wanted to know if there was an easy way to explain their difference, as I know they are both related to a player but they still cant be used in the same spot.


What part?
Related to players or cant be used in the same spot?

you obviously don’t know what a variable is, then

This is a variable

local something = LocalPlayer()

local pl = LocalPlayer()
local ply = LocalPlayer()

you have to define it to actually “be something”

These are variables. Variables stores value of something you type or you get it from other functions like LocalPlayer(). Example you can typ local health = 100, or local health = LocalPlayer():GetHealth() (or was it just Health()?).

Else would be internal function. They are already defined if you call a function but ofc you have again the choice to do ply pl or player or plyer what ever.
function GM:PlayerSpawn( ply )
ply:Msg(“You are spawned”)

Oh so pl, ply are LocalPlayer() ?

Not necessarily; pl and ply are just popular variable names used to identify player objects. The don’t actually refer to a player object until you assign them properly or are passed by a called hook, etc.

local pl = player.GetByID(1)

– or

function MyAuthFunc(pl, steamid, uniqueid)
hook.Add(“PlayerAuthed”, “MyAuthHook”, MyAuthFunc)

But is there a difference between pl and ply?

They’re variables. Your question doesn’t make sense.
It’s like asking why the sky is yellow, when it obviously isn’t
Or why that car’s weel is square

Ok are pl and ply both player.GetByID(1) or is ply equal to something else?

you could call it aHugeMassiveShlong if you wanted to. pl and ply are simply variables.


[lua]local pl,ply,aHugeMassiveShlong = LocalPlayer(),player.GetByID(1),player.GetByID(5);[/lua]

All three are players. Are they the same? Probably not. Do they have to be players? No. You could assign it to anything.

teras, go learn about variables http://www.lua.org/pil/

[editline]3rd September 2012[/editline]

Actually read the whole pil.

Neither pl or ply actually do anything. If you tried to just do something like…

[lua]print(ply) [/lua]

it wouldn’t work. You have to assign a variable to something and then the variable will hold that value.

local ply
local pl


Neither of those would work either.

local ply = LocalPlayer()
local pl = 15
local p = “This is the last line”



This would print…
A player object
This is the last line

I hope that helps.

Wow…that was…

I just hope he understands now.

Ok one last questin I know why you guys are raging, what are they assigned to in sandbox?