All pastes #628656 Raw Edit

inertial swep gmod9

public lua v1 · immutable
·published 2007-07-21 14:24 UTC
rendered paste body
_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 weaponCurrentTime		=	0; -- The current game timeswep_is_owner = true;function SWEPisOwnerOfThisProp(bool_val)if(bool_val == true) thenswep_is_owner = trueelseswep_is_owner = falseendendfunction getEntity(id, dist)position = _PlayerGetShootPos(id);angle = _PlayerGetShootAng(id);local result = false;_TraceLine(position, angle, dist, id);if (_TraceHitNonWorld()) and (_TraceGetEnt() > _MaxPlayers()) thenresult = _TraceGetEnt();endreturn result;endfunction onPickup( playerid )-- When the player picks this weapon up...endfunction onDrop( playerid )--player drops this weapon...dies weapon outendfunction onRemove()-- When this weapon is deleted from the ground...endfunction Deploy()-- When the player swaps to this weapon...endfunction Holster()-- When the player swaps away from this weapon...endfunction onInit()--_SWEPSetSound( MyIndex, "single_shot", "Weapon_USP.Single" )	-- Sets the soundendfunction onThink()endfunction 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; endlocal 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);endendfunction 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; endlocal 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);endendfunction onReload()return trueend-- ==========================================-- Basic Weapon Display Settings:-- ==========================================function getHUDMaterial()	return "gmod/SWEP/default"; endfunction getDeathIcon()		return "swep_default"; endfunction getWeaponSwapHands() 	return true; endfunction getWeaponFOV() 	return 74; endfunction getWeaponSlot() 	return 2; endfunction getWeaponSlotPos() 	return 7; endfunction getViewModel() 	return "models/weapons/v_pist_usp.mdl"; endfunction getWorldModel()	return "models/weapons/w_pist_usp.mdl"; endfunction getAnimPrefix()	return "pistol"; endfunction getPrintName() 	return "DrogenViechs\nModded Inertial"; endfunction getClassName() 	return "weapon_drogenviech_inertial"; end-- ==========================================-- Basic Attributes:-- ==========================================function getFiresUnderwater()	return true; endfunction getReloadsSingly() 	return false; end-- ==========================================-- Primary Fire Settings:-- ==========================================function getDamage() 			return 0; endfunction getPrimaryShotDelay() 		return 0.1; endfunction getPrimaryIsAutomatic() 	return false; endfunction getNumShotsPrimary()		return 1; endfunction getMaxClipPrimary() 		return 255; endfunction getDefClipPrimary() 		return 255; endfunction getPrimaryAmmoType() 		return "XBowBolt"; endfunction getPrimaryScriptOverride()	return 2; endfunction getTracerFreqPrimary()		return 1; endfunction getBulletSpread() 		return vector3(0.0, 0.0, 0.0); endfunction getViewKick() 			return vector3(0.0, 0.0, 0.0); endfunction getViewKickRandom() 		return vector3(0.0, 0.0, 0.0); end-- ==========================================-- Secondary Fire Settings:-- ==========================================function getDamageSecondary()		return 0; endfunction getSecondaryShotDelay() 	return 0.1; endfunction getSecondaryIsAutomatic() 	return false; endfunction getNumShotsSecondary()		return 1; endfunction getMaxClipSecondary() 		return 255; endfunction getDefClipSecondary() 		return 255; endfunction getSecondaryAmmoType() 	return "XBowBolt"; endfunction getSecondaryScriptOverride() 	return 2; endfunction getTracerFreqSecondary()	return 1; endfunction getBulletSpreadSecondary()	return vector3(0.0, 0.0, 0.0); endfunction getViewKickSecondary() 	return vector3(0.0, 0.0, 0.0); endfunction getViewKickRandomSecondary() 	return vector3(0.0, 0.0, 0.0); end