Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
ENT.WeaponUsed= "cw_ar15" -- name of the swep that the case is for
^ this variable already lets us know what weapon class it is, so you can just get it's data by doing:
local wepData = weapons.GetStored(self.WeaponUsed)
and then assign SwepName, AmmoUsed and AmmoAmountToGive like this:
self.SwepName = wepData.PrintName
self.AmmoUsed = wepData.Primary.Ammo
self.AmmoAmountToGive = wepData.Primary.ClipSize
you'd need to put this in a shared ENT:Initialize hook, the entire code snippet (which is pseudo-code, but it should work) would look like this:
ENT:Initialize()
-- do stuff that your cases do
local wepData = weapons.GetStored(self.WeaponUsed)
self.SwepName = wepData.PrintName
self.AmmoUsed = wepData.Primary.Ammo
self.AmmoAmountToGive = wepData.Primary.ClipSize
end
and bam, now you only have to enter 1 variable (instead of 4), and the rest would be handled for you
this way you'll reduce the amount of code needed to enter to just 1 variable, and it also means that if there are changes to the weapon code at any time in the base CW 2.0 pack or elsewhere (ie. weapon name change, mag size change, caliber change, etc.) you don't have to change anything at all in your case code
This is perfect, thank you just, I will defenitly use this. I am still new to lua so I will accept all advice given, even to a professional such as yourself.
The new code is already implemented, go nuts.
i ask permission to upload this for use as an pseudo-shipment of sorts.