_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
myTimeont = 0;
myTime = 0;
set = 2;
flyspeed = 2820;
backwards = 0;
textenabled = 0;
function helptext()
_GModText_Start("TargetID");
_GModText_SetPos(0.10, 0.125);
_GModText_SetColor( 222, 223, 148, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "DrogenViechs Lazer Gun" );
_GModText_Send( Owner, 48500);
if backwards == 0 then
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.205);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Direction: Forward");
_GModText_Send( Owner, 48502);
elseif backwards == 1 then
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.205);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Direction: Backward");
_GModText_Send( Owner, 48502);
end
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.235);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Modes Switchting: Right Click To Switch Power");
_GModText_Send( Owner, 48503);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.265);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Primary Fire: Fires");
_GModText_Send( Owner, 48504);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.285);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Secondary: Switch Power");
_GModText_Send( Owner, 48505);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.315);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Press Reload To Switch Direction");
_GModText_Send( Owner, 48506);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.2, 0.175);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Thanks To Reaper

");
_GModText_Send( Owner, 48510);
--_GModText_Start("DefaultShadow");
--_GModText_SetPos(0.10, 0.335);
--_GModText_SetColor( 255, 255, 255, 255 );
--_GModText_SetTime(5,0,1);
--_GModText_SetText( "NEW: Usekey = Freeze");
--_GModText_Send( Owner, 4851

;
_GModRect_Start("gmod/white")
_GModRect_SetPos(0.075, 0.115,0.350,0.265)
_GModRect_SetColor(0,0,0,12

;
_GModRect_SetTime(5,0,1);
_GModRect_Send( Owner, 48600);
end
function onPickup( playerid ) -- When the player picks this weapon up...
end
function onDrop( playerid ) -- When the player drops this weapon... (when he dies with this 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() -- When this script is loaded... (If your gun will shoot objects, precache the model this gun will shoot here)
--_SWEPSetSound( MyIndex, "single_shot", "Weapon_USP.Single" ) -- Sets the sound
end
function onThink() -- Called every frame (Constantly)
--if(_CurTime() > myTimeont+0.5) then
--if _PlayerIsKeyDown(Owner, IN_USE) then
--local ontmvtpe = _EntGetMoveType(Owner)
--if ontmvtpe ~= MOVETYPE_NONE then
--_EntSetMoveType(Owner, MOVETYPE_NONE)
--_EntSetVelocity( Owner, vector3(0,0,0));
--_PrintMessage(Owner,HUD_PRINTTALK,"FLYGUN: FROZEN, PRESS THE USEKEY (e) AGAIN TO UNFREEZE !")
--elseif ontmvtpe == MOVETYPE_NONE then
--_EntSetVelocity( Owner, vector3(0,0,0));
--_EntSetMoveType(Owner, MOVETYPE_WALK)
--end
--myTimeont = _CurTime()
--end
--end
end
function onPrimaryAttack() -- When the player hits primary fire...
if ( _PlayerInfo( Owner, "connected" ) == false ) then return; end
if ( _PlayerInfo( Owner, "alive" ) == false ) then return; end
local plyang = _PlayerGetShootAng( Owner );
if (plyang == nil) then _Msg("Playerang was null!\n") return; end;
if textenabled == 1 then
local playerang = _PlayerGetShootAng(Owner)
local playervel = vecMul(playerang, vector3(flyspeed, flyspeed, flyspeed) );
_EntSetVelocity( Owner, playervel );
elseif textenabled == 0 then
if(_CurTime() > myTime+1.0) then
_PrintMessage(Owner,HUD_PRINTCENTER,"Press Rightclick To Change Modes")
myTime = _CurTime()
end
end
end
function onSecondaryAttack() -- When the player hits secondary fire...
if (set == 1) then
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.185);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Fast");
_GModText_Send( Owner, 48501);
if backwards == 1 then
flyspeed = -2820
else
flyspeed = 2820
end
set = 2
elseif (set == 2) then
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.185);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Normal");
_GModText_Send( Owner, 48501);
if backwards == 1 then
flyspeed = -1410
else
flyspeed = 1410
end
set = 3
elseif (set == 3) then
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.185);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Slow");
_GModText_Send( Owner, 48501);
if backwards == 1 then
flyspeed = -705
else
flyspeed = 705
end
set = 1
end
helptext()
textenabled = 1;
end
function onReload() -- When the player hits reload... (Keep the return true, or change to false to not allow the player to reload)
if(_CurTime() > myTime+0.3) then
helptext()
if backwards == 1 then
backwards = 0
flyspeed = 705
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.205);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Direction: Forward");
_GModText_Send( Owner, 48502);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.185);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Slow");
_GModText_Send( Owner, 48501);
else
backwards = 1
flyspeed = -705
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.205);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Direction: Backward");
_GModText_Send( Owner, 48502);
_GModText_Start("DefaultShadow");
_GModText_SetPos(0.10, 0.185);
_GModText_SetColor( 255, 255, 255, 255 );
_GModText_SetTime(5,0,1);
_GModText_SetText( "Slow");
_GModText_Send( Owner, 48501);
end
set = 1
end
myTime = _CurTime()
end
-- ==========================================
-- Basic Weapon Display Settings:
-- ==========================================
function getHUDMaterial() return "gmod/SWEP/Default"; end -- This weapon's picture in the HUD weapons browser
function getDeathIcon() return "swep_Default"; end -- The picture of the gun you killed someone with in upper right hand corner (swep_DefaultShadow is the Pac-Man-like logo for Gmod)
function getWeaponSwapHands() return false; end -- Return true for right-handed in CSS, false for right-handed in HL2.
function getWeaponFOV() return 74; end -- Feild of veiw (a higher number makes the gun appear further away from you)
function getWeaponSlot() return 1; end -- Weapon slot (0-5) 0=crowbar, 1=pistol, 2=smg, 3=shotgun, 4=grenade, 5=pheropod (bugbait)
function getWeaponSlotPos() return 7; end -- Slot position (0-infinity, make sure it won't cover up existing weapons though) 0=crowbar, 1=stunstick, 2=grav gun, 3=physgun, etc.
function getViewModel() return "models/weapons/v_shotgun.mdl"; end -- The view model (What it looks like when it's in your hands)
function getWorldModel() return "models/weapons/w_shotgun.mdl"; end -- The world model (What it looks like when it is spawned on the ground)
function getAnimPrefix() return "pistol"; end -- The animations for the viewmodel (Kind of like how you hold it) (pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade)
function getPrintName() return "DrogenViechs\nFlygun"; end -- What the weapon is called in the HUD weapons browser
function getClassName() return "weapon_drogenviech_flygun"; end -- What the weapons is called by the console when it reports a kill
-- ==========================================
-- Basic Attributes:
-- ==========================================
function getFiresUnderwater() return true; end -- Can it shoot underwater?
function getReloadsSingly() return false; end -- Reload after each shot? (like a shotgun)
-- ==========================================
-- Primary Fire Settings:
-- ==========================================
function getDamage() return 0; end -- Primary fire damage, per bullet
function getPrimaryShotDelay() return 0.1; end -- Delay between primary fire shots (in seconds)
function getPrimaryIsAutomatic() return true; end -- Is primary fire automatic? (can you hold down the mouse and it will fire repeatedly?)
function getNumShotsPrimary() return 1; end -- Number of bullets per shot (The HL2 shotgun uses 7)
function getMaxClipPrimary() return 255; end -- How much primary ammo each clip can hold before you have to reload ( -1 = Infinate)
function getDefClipPrimary() return 255; end -- How much primary ammo is in the gun when it's spawned (Should be more than the clip can hold) ( -1 = Infinate)
function getPrimaryAmmoType() return "XBowBolt"; end -- Primary ammo type; NOTE - this only matters when you plan on picking up more ammo for the gun later! It does not effect the performance of the gun whatsoever. (Pistol, 357, Buckshot, SMG1, smg1_grenade, AR2, AR2AltFire, XBowBolt, rpg_round, grenade, slam)
function getPrimaryScriptOverride() return 3; end -- 0 = Don't override (shoot bullets, make sound and flash), 1 = Just make flash/sounds (no bullets), 2 = Just animations, 3 = Do nothing (Still calls onPrimaryAttack)
function getTracerFreqPrimary() return 1; end -- How often a primary ammo bullet is a tracer round (0 = no tracers, 1 = every bullet is a tracer, 2 = every other bullet is a tracer, etc.)
function getBulletSpread() return vector3(0.0, 0.0, 0.0); end -- Bullet spread, not view shake (X=down, Y=left, Z=clockwise spin)
function getViewKick() return vector3(0.0, 0.0, 0.0); end -- Veiw kick for each shot(X=down, Y=left, Z=clockwise spin) (You can use negatives to make it go the opposite direction)
function getViewKickRandom() return vector3(0.0, 0.0, 0.0); end -- Veiw kick random (X=up or down, Y=left or right, Z=clockwise or counterclockwise spin)
-- ==========================================
-- Secondary Fire Settings:
-- ==========================================
function getDamageSecondary() return 0; end -- Secondary fire damage, per bullet
function getSecondaryShotDelay() return 0.25; end -- Delay between secondary fire shots (in seconds)
function getSecondaryIsAutomatic() return false; end -- Is secondary fire automatic? (Can you hold down the mouse and it will fire repeatedly?)
function getNumShotsSecondary() return 1; end -- Number of bullets per shot (the HL2 shotgun's secondary fire uses 14 for secondary fire)
function getMaxClipSecondary() return 255; end -- How much secondary ammo each clip can hold before you have to reload ( -1 = Infinate)
function getDefClipSecondary() return 255; end -- How much secondary ammo is in the gun when it's spawned (Should be more than the clip can hold) ( -1 = Infinate)
function getSecondaryAmmoType() return "XBowBolt"; end -- Secondary ammo type; NOTE - this only matters when you plan on picking up more ammo for the gun later! It does not effect the performance of the gun whatsoever. (Pistol, 357, Buckshot, SMG1, smg1_grenade, AR2, AR2AltFire, XBowBolt, rpg_round, grenade, slam)
function getSecondaryScriptOverride() return 2; end -- 0 = Don't override (shoot bullets, make sound and flash), 1 = Just make flash/sounds (no bullets), 2 = Just animations, 3 = Do nothing (Still calls onSecondaryAttack)
function getTracerFreqSecondary() return 1; end -- How often a secondary ammo bullet is a tracer round (0 = no tracers, 1 = every bullet is a tracer, 2 = every other bullet is a tracer, etc.)
function getBulletSpreadSecondary() return vector3(0.0, 0.0, 0.0); end -- Secondary fire bullet spread, not view shake (X=down, Y=left, Z=clockwise spin)
function getViewKickSecondary() return vector3(0.0, 0.0, 0.0); end -- View kick for secondary fire (X=down, Y=left, Z=clockwise spin) (You can use negatives to make it go the opposite direction)
function getViewKickRandomSecondary() return vector3(0.0, 0.0, 0.0); end -- Veiw kick random for secondary fire (X=up or down, Y=left or right, Z=clockwise or counterclockwise spin)