Hiho
Bin neu im Forum
Also ich suche ein Waffe die es mir ermöglicht mehrere Gegenstände aufeinmal zu welden (zusammenzukleben).
Ich hab hier eine .lua doch leider weiss ich nicht wie ich diese im Spiel einfüge.
-- This is the base SWEP (Scripted Weapon).
-- DO NOT change this file.
-- When making a new weapon you only need to override what you need.
_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
props = { };
weldlimit = -1 --Maximum number of props to group weld. (-1 is unlimited)
-- Called when the weapon is created.
function onInit( )
_WeaponFlipHands("weapon_groupweld", true);
_SWEPSetSound(MyIndex, "single_shot", "Weapon_M4A1.Silenced");
_RunString([[
if (gw == nil) then gw = {}; end
if (constraints == nil) then constraints = {}; end
function gw.think()
for i in constraints do
if not _EntExists(constraints[i].firstprop) or not _EntExists(constraints[i].secprop) then
_EntRemove(constraints[i].id);
--_Msg("GW Const " .. constraints[i].id .. " removed.\n");
table.remove(constraints, i);
end
end
end
AddThinkFunction(gw.think);
_Msg("GW Loaded!\n");
]]);
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
-- When the player presses left mouse button
function onPrimaryAttack( )
local vecpos = _PlayerGetShootPos( Owner );
local plyang = _PlayerGetShootAng( Owner );
_TraceLine( vecpos, plyang, 8000, Owner );
if (_TraceHitWorld() == true) or (_TraceHit() == false) then return; end
local hitpos = _TraceEndPos();
local ent = _TraceGetEnt();
local check = false
for i in props do
if (props[i] == ent) then
_EntFire(ent, "color", "255 255 255", 0);
table.remove(props, i);
check = true
end
end
if check ~= true and table.getn(props) < weldlimit or check ~= true and weldlimit == -1 then
_EntFire(ent, "color", "0 255 0", 0);
table.insert(props,ent);
end
end
-- When the player presses right mouse button
function onSecondaryAttack( )
local propsexist = { }
local propswelded = { }
local welds = 0
local welded = false
for i in props do
if _EntExists(props[i]) then
table.insert(propsexist, props[i]);
end
end
for i in propsexist do
for j in propsexist do
welded = false
for k in propswelded do
if propsexist[j] == propswelded[k] then
welded = true
end
end
if propsexist[j] ~= propsexist[i] and welded ~= true then
local firstprop = propsexist[i];
local secprop = propsexist[j];
local id = WeldEntities(firstprop, secprop);
welds = welds + 1
_RunString([[
hash = {};
hash.firstprop = ]] .. firstprop .. [[
hash.secprop = ]] .. secprop .. [[
hash.id = ]] .. id .. [[
table.insert(constraints, hash);
]]);
end
end
table.insert(propswelded, propsexist[i]);
end
for i in propsexist do
_EntFire(propsexist[i], "color", "255 255 255", 0);
end
props = { }
_PrintMessage(Owner, 2, welds .. " welds (" .. table.getn(propsexist) .. " props) done!\n");
end
-- When Weapon is swapped to
function Deploy( )
end
-- When weapon swapped away from
function Holster( )
end
-- When player presses reload. Returning false means DON'T RELOAD. Although this will hitch on the client.
function onReload( )
return false;
end
-- Primary Attack Settings
function getDamage()
return 10;
end
function getPrimaryShotDelay()
return 0.1;
end
function getPrimaryIsAutomatic()
return false;
end
function getBulletSpread()
return vector3( 0.01, 0.01, 0.01 );
end
function getViewKick()
return vector3( 0, 0, 0);
end
function getViewKickRandom()
return vector3( 0, 0, 0 );
end
function getNumShotsPrimary()
return 1;
end
function getPrimaryAmmoType()
return "pistol";
end
function getMaxClipPrimary() -- return -1 if it doesn't use clips
return -1;
end
function getDefClipPrimary() -- ammo in gun by default
return 1;
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.1;
end
function getSecondaryIsAutomatic()
return false;
end
function getBulletSpreadSecondary()
return vector3( 0.001, 0.001, 0.001 );
end
function getViewKickSecondary()
return vector3( 0, 0.0, 0.0);
end
function getViewKickRandomSecondary()
return vector3( 0, 0, 0 );
end
function getNumShotsSecondary()
return 1;
end
function getSecondaryAmmoType()
return "pistol";
end
function getMaxClipSecondary() -- return -1 if it doesn't use clips
return -1;
end
function getDefClipSecondary()
return 1;
end
function getTracerFreqSecondary()
return 2;
end
-- Weapon Configuration
function getViewModel( )
return "models/weapons/v_pist_deagle.mdl";
end
function getWorldModel( )
return "models/weapons/w_pist_deagle.mdl";
end
function getClassName()
return "weapon_groupweld";
end
function getHUDMaterial( )
return "gmod/SWEP/default";
end
function getDeathIcon( )
return "swep_default";
end
function getWeaponSwapHands()
return true
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 "pistol";
end
function getPrintName()
return "Group Welder";
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 1;
end
Also ich hoffe mir kann jemmand eine Waffe posten oder sagen wie ich diese im Spiel einfüge.
MfG
Vulcano