ID:142464
 
Code:
        NP20_Ammo
icon='weapons.dmi'
icon_state="ammo"
verb/load()
var/obj/o = locate(/obj/Weapons/pistol) in usr.contents
if(!o)
alert("You do not have an NP-20")
return
o.Ammo+=30//This is my problem right here!
usr<<"<font color=teal> You add 30 rounds to your NP-20"
del src
return

That is the Ammo that you collect and load into your gun, if you have one that is.
obj/Weapons
icon = 'Weapons.dmi'
suffix = "UnEquipped"
var
BulletIcon = 'Weapons.dmi'
BulletIcon_State = ""
BulletIconRGB = list(0,0,0)
BulletDammage = 0
BulletSpeed = 2
Bulletsound=""
ShootingSpeed = 2
WeaponRange = 9
Ammo=30
tmp/IsShooting

Defining the default vars for the weapons.

obj/Weapons/pistol
name = "NP-20 9mm"
icon_state = "gun"
BulletIcon_State = "bullet"
BulletIconRGB = list(0,0,0)
BulletDammage = 10
BulletSpeed = 1
Bulletsound='np20.wma'
ShootingSpeed = 10
WeaponRange = 5
Ammo=30

That is basicly just the vars for this particular weapon.

Problem description:

I get the error : Stargate Atlantis Discovery\Objects.dm:93:error:o.Ammo:undefined var

i have tried adding the Ammo var everywhere and no luck.

Any help will be appreciated =)

"var/obj/o" should be "var/obj/Weapon/o"
There are a lot of other problems with that code, but the primary problem is that you are casting o and an /obj when it should be /obj/Weapons. You should also be closing your HTML tags, and the return there at the end is also useless.
In response to Jemai1
Ah...makes sense, thanks guys.