`RegisterCommand` function does not return `source` variable

Hello there! :raised_hand:
I met with really interesting problem when I was coding my script.
The RegisterCommand function in the client side of lua lang does not return the source variable.
And I am wondering how to figure this out because I never was seen this before and I came here
to ask for help. Thanks to everybody’s advice! Every single advice helps!

Additional information about the problem (answering some questions and providing image/s):
Programing language: lua;
Side: client;
Do I have sv_lan1 convar in server.cfg: no;
Did I change something before this happened: I don’t think so, nothing’s changed;
When this happened: I don’t remember too well but maybe before one week before the post date or something;
What’s the returned value: 0 (or nil because I can see from tx or other method that my Id is 1).

Images:
Test command code:
TestCommand code
Test command use & return value:
TestCommandUse

There is no source on the client side. Not sure why you would need it, the person executing the command is always the current client.

As a friend above said, there is no source on client side. But if you have a need of getting player’s server id on client side you can use GetPlayerServerId(PlayerId()) :wink:

Yes, I know that but then why source variable should be there when it can’t be there actually because it returns 0 (nil), and I understand that source cannot be there because it’s in the client side and the player that use the code of this script always is the current client but then why the source variable value it’s not GetPlayerServerId(PlayerId())… And also I think I was using the source before in the client side and it was working but I may have been mistaken. And thank you for the help!

I told this to the other guy. I understand that the source variable cannot actually be there because that is the client side and the source actually always is there and you can get it. And I am using the GetPlayerServerId(PlayerId()) code when I need to get the player Id in the client side from some event/function and other but I was using the source variable before in the RegisterCommand function and it was working… That’s the reason why I didn’t use the code GetPlayerServerId(PlayerId()) in the RegisterCommand function because the Id of the player that uses the command is there with the source variable but… I may have been mistaken. And thanks for the help!

Also, now I am watching some functions from the docs and I am wondering why when that is the client side some functions have playerId/player/serverId values ​​to fill when we know that we have the client in the client side? (Example for that: GetPlayerMaxStamina(playerId) )

Because the function prototype is the same on the client and server.

Because some natives can be used on other players too. Use PlayerId() to use those on the current client, you don’t need the source for that.

You’re right, you’re right you don’t need it but then why even source is there in the RegisterCommand native when it’s nil… Never mind. Thanks for the help.