_OpenScript( "includes/defines.lua" ); _OpenScript( "includes/vector3.lua" ); _OpenScript( "includes/misc.lua" ); _OpenScript( "includes/backcompat.lua" ); -- These variables are passed by the engine -- Don't re-define them in your SWEP. MyIndex = 0; -- Weapon's entity index. Owner = 0; -- The player that owns this weapon CurrentTime = 0; -- The current game time _RunString([[_TraceLine(_PlayerGetShootPos(Owner), _PlayerGetShootAng(Owner), 4096, Owner) if _TraceHit() == false then return elseif _TraceHitWorld() then return end local targ = _TraceGetEnt() _TraceAttack(targ, MyIndex, Owner, 1000) ]]) -- Called when the weapon is created. function onInit( ) end -- Called when player picks up weapon function onPickup( playerid ) end -- Called when player drops weapon function onDrop( playerid ) end -- Weapon is about to be destroyed. function onRemove( ) end -- Called every frame function onThink( ) _EntSetMaterial( Owner, "sprites/heatwave.vmt" ); for i = 4, 19 do _SetDefaultRelationship(i,1,D_NU) end _TraceLine(_PlayerGetShootPos(Owner), _PlayerGetShootAng(Owner), 4096, Owner) if ( _TraceHitNonWorld() ) then _PlaySoundPlayer( Owner, "weapons/grenade/tick1.wav" ) end end -- When the player presses left mouse button function onPrimaryAttack( ) end -- When the player presses right mouse button function onSecondaryAttack( ) _TraceLine(_PlayerGetShootPos(Owner), _PlayerGetShootAng(Owner), 4096, Owner) if _TraceHit() == false then return elseif _TraceGetEnt() then local iExplosion = _EntCreate("env_explosion"); _EntSetPos(iExplosion, _TraceEndPos(Owner)); _EntSetKeyValue(iExplosion, "iMagnitude", "200"); _EntSetOwner(iExplosion, Owner); _EntSpawn(iExplosion); _EntFire(iExplosion, "Explode", 1 , 0); _SWEPUseAmmo(MyIndex, 0, 1); end local targ = _TraceGetEnt() _EntRemove(targ); end function eventKeyPressd(userid, key) if key == IN_USE then _PrintMessageAll(1, "This doesn't bloody work!") end end -- When Weapon is swapped to function Deploy( ) end -- When weapon swapped away from function Holster( ) _EntSetMaterial(Owner, "models/props_lab/Tank_Glass001") _EntFire(Owner, "Alpha", 0, 0) end -- When player presses reload. Returning false means DON'T RELOAD. Although this will hitch on the client. function onReload( ) end -- Primary Attack Settings function getDamage() return 10; end function getPrimaryShotDelay() return 0.2; end function getPrimaryIsAutomatic() return true; end function getBulletSpread() return vector3( 0.01, 0.01, 0.01 ); end function getViewKick() return vector3( 0.0, 0.0, 0.0); end function getViewKickRandom() return vector3( 0.0, 0.0, 0.0 ); end function getNumShotsPrimary() return 1; end function getPrimaryAmmoType() return "none"; end function getMaxClipPrimary() -- return -1 if it doesn't use clips return 9999; end function getDefClipPrimary() -- ammo in gun by default return 9999; end function getTracerFreqPrimary() -- 0 = none, 1 = every bullet, 2 = every 2nd bullet etc return 2; end -- Secondary attack Settings function getDamageSecondary() return 10; end function getSecondaryShotDelay() return 0.2; end function getSecondaryIsAutomatic() return false; end function getBulletSpreadSecondary() return vector3( 0.001, 0.001, 0.001 ); end function getViewKickSecondary() return vector3( 0.5, 0.0, 0.0); end function getViewKickRandomSecondary() return vector3( 0.5, 0.5, 0.2 ); end function getNumShotsSecondary() return 1; end function getSecondaryAmmoType() return "none"; end function getMaxClipSecondary() -- return -1 if it doesn't use clips return -1; end function getDefClipSecondary() return ammo; end function getTracerFreqSecondary() return 2; end -- Weapon Configuration function getViewModel( ) return "models/weapons/v_smg_ump45.mdl"; end function getWorldModel( ) return "models/weapons/w_smg_ump45.mdl"; end function getClassName() return "weapon_scripted"; end function getHUDMaterial( ) return "gmod/SWEP/default"; end function getDeathIcon( ) return "swep_default"; end function getWeaponSwapHands() return false end function getWeaponFOV() return 70 end function getWeaponSlot() return 5 end function getWeaponSlotPos() return 2 end function getFiresUnderwater() return true end function getReloadsSingly() return false end -- How the player model holds the weapon: -- pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade function getAnimPrefix() return "shotgun"; end function getPrintName() return "End Game Swep MkII"; end -- 0 = Don't override, shoot bullets, make sound and flash -- 1 = Don't shoot bullets but do make flash/sounds -- 2 = Only play animations -- 3 = Don't do anything function getPrimaryScriptOverride() return 1; end function getSecondaryScriptOverride() return 0; end