noob lua help im so bad

SWEP.Primary.ClipSize = 15

function SWEP:ClipSize()
self.Owner:SteamID() == “STEAM_0:1:40852869” then

end

how do i change per player is it just return 100 or something

Try making an if statement, untested but might work.



if self.Owner:SteamID() == "STEAM_0:1:40852869" then
 SWEP.Primary.ClipSize = 100
end


It won’t.

[lua]if self.Owner:SteamID() == “STEAM_0:1:40852869” then
SWEP.Primary.ClipSize = 100
else
SWEP.Primary.ClipSize = 20 – or whatever other default
end[/lua]
If that fails, try specifying a rank instead of a steamid.
[lua]if ply:IsUserGroup(“YOUR_RANK_HERE”) then
SWEP.Primary.ClipSize = 100
else
SWEP.Primary.ClipSize = 20 – or whatever other default
end[/lua]

You’d need to use self; SWEP is defined when the weapons are loaded ( should be pulled into a table, kind of like how pointshop loads items ). It’d need to be properly networked, so a shared function for it to be dynamic…

yeah that makes more sense. i tryed this but LocalPlayer() cannot be used in a shared file.

Says who? You can use it in a shared file but not SERVERSIDE.

Looking at this I am not the best LUA coder but this looks like this could work.

it warms my heart so much to see new coders on these forums

garrys mod can be hard to code for since the documentation is a bit scattered, at least in my little bit of experience, try learning lua itself before coding in garrys mod!

[editline]22nd October 2014[/editline]

actually i targetted this at the op but still

i thought it was that but i didnt want errors lol