Weapon on server-side

Hello. Please tell me how to give a weapon a player through a command on the server-side.
I use the method GIVE_WEAPON_TO_PED - RedM Native Reference (vespura.com)
This code does not work (c#). What could be a mistake?

RegisterCommand("gag", new Action<int, List<object>, string>((source, args, raw) =>
            {
                Player player = Players[source];
                int pedId = NetworkGetEntityFromNetworkId(source);
                uint hash = (uint)GetHashKey("weapon_shotgun_pump");
                
                GiveWeaponToPed(pedId, hash, 50, false, true);
                 //GiveWeaponToPed(source, hash, 50, false, true);
                //GiveWeaponToPed(player.Character.NetworkId, hash, 50, false, true);
            }), false);

Is it safe to give weapons on command on the client side?

If it’s gonna be a simple command anyone can use (unprotected) I would honestly just move this over to the client