_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 swep_is_owner = true; function SWEPisOwnerOfThisProp(bool_val) if(bool_val == true) then swep_is_owner = true else swep_is_owner = false end end function getEntity(id, dist) position = _PlayerGetShootPos(id); angle = _PlayerGetShootAng(id); local result = false; _TraceLine(position, angle, dist, id); if (_TraceHitNonWorld()) and (_TraceGetEnt() > _MaxPlayers()) then result = _TraceGetEnt(); end return result; end function onPickup( playerid )-- When the player picks this weapon up... end function onDrop( playerid )--player drops this weapon...dies weapon out end function onRemove()-- When this weapon is deleted from the ground... end function Deploy()-- When the player swaps to this weapon... end function Holster()-- When the player swaps away from this weapon... end function onInit() --_SWEPSetSound( MyIndex, "single_shot", "Weapon_USP.Single" ) -- Sets the sound end function onThink() end function onPrimaryAttack() _TraceLine(_PlayerGetShootPos(Owner),_PlayerGetShootAng(Owner), 4096, Owner); _RunString("prop_protectionSWEPWrapper(".. Owner ..",".._TraceGetEnt()..",".. MyIndex ..",\"SWEPisOwnerOfThisProp\")") if(swep_is_owner == false) then return false end; if (not _PlayerInfo(Owner, "alive")) then return; end local entityToSetUngrav = getEntity(Owner, 4096); if (entityToSetUngrav) then _EntEmitSound(Owner,"gmod/pop.wav"); _PhysEnableGravity(entityToSetUngrav, false); _GModText_Start( "Default" ); _GModText_SetEntity(entityToSetUngrav); _GModText_SetColor(255, 255, 255, 255); _GModText_SetTime(3, 0.5, 0.5); _GModText_SetEntityOffset(vector3(0, 0, 0)); _GModText_SetText("Gravity : OFF"); _GModText_Send(0, 1 + entityToSetUngrav); end end function onSecondaryAttack() _TraceLine(_PlayerGetShootPos(Owner),_PlayerGetShootAng(Owner), 4096, Owner); _RunString("prop_protectionSWEPWrapper(".. Owner ..",".._TraceGetEnt()..",".. MyIndex ..",\"SWEPisOwnerOfThisProp\")") if(swep_is_owner == false) then return false end; if (not _PlayerInfo(Owner, "alive")) then return; end local entityToSetUngrav = getEntity(Owner, 4096); if (entityToSetUngrav) then _EntEmitSound(Owner,"gmod/pop.wav"); _PhysEnableGravity(entityToSetUngrav, true); _GModText_Start( "Default" ); _GModText_SetEntity(entityToSetUngrav); _GModText_SetColor(255, 255, 255, 255); _GModText_SetTime(3, 0.5, 0.5); _GModText_SetEntityOffset(vector3(0, 0, 0)); _GModText_SetText("Gravity : ON"); _GModText_Send(0, 1 + entityToSetUngrav); end end function onReload() return true end -- ========================================== -- Basic Weapon Display Settings: -- ========================================== function getHUDMaterial() return "gmod/SWEP/default"; end function getDeathIcon() return "swep_default"; end function getWeaponSwapHands() return true; end function getWeaponFOV() return 74; end function getWeaponSlot() return 2; end function getWeaponSlotPos() return 7; end function getViewModel() return "models/weapons/v_pist_usp.mdl"; end function getWorldModel() return "models/weapons/w_pist_usp.mdl"; end function getAnimPrefix() return "pistol"; end function getPrintName() return "DrogenViechs\nModded Inertial"; end function getClassName() return "weapon_drogenviech_inertial"; end -- ========================================== -- Basic Attributes: -- ========================================== function getFiresUnderwater() return true; end function getReloadsSingly() return false; end -- ========================================== -- Primary Fire Settings: -- ========================================== function getDamage() return 0; end function getPrimaryShotDelay() return 0.1; end function getPrimaryIsAutomatic() return false; end function getNumShotsPrimary() return 1; end function getMaxClipPrimary() return 255; end function getDefClipPrimary() return 255; end function getPrimaryAmmoType() return "XBowBolt"; end function getPrimaryScriptOverride() return 2; end function getTracerFreqPrimary() return 1; end function getBulletSpread() return vector3(0.0, 0.0, 0.0); end function getViewKick() return vector3(0.0, 0.0, 0.0); end function getViewKickRandom() return vector3(0.0, 0.0, 0.0); end -- ========================================== -- Secondary Fire Settings: -- ========================================== function getDamageSecondary() return 0; end function getSecondaryShotDelay() return 0.1; end function getSecondaryIsAutomatic() return false; end function getNumShotsSecondary() return 1; end function getMaxClipSecondary() return 255; end function getDefClipSecondary() return 255; end function getSecondaryAmmoType() return "XBowBolt"; end function getSecondaryScriptOverride() return 2; end function getTracerFreqSecondary() return 1; end function getBulletSpreadSecondary() return vector3(0.0, 0.0, 0.0); end function getViewKickSecondary() return vector3(0.0, 0.0, 0.0); end function getViewKickRandomSecondary() return vector3(0.0, 0.0, 0.0); end