nagut also ich fang dann mal an : Wenn du eine Selbst erstellte Waffe hast sieht der code in etwa so aus (ausschnitt aus der LUA Standart Waffe):
Code:
MyIndex = 0; -- Weapon's entity index.
Owner = 0; -- The player that owns this weapon
CurrentTime = 0; -- The current game time
-- This is called when the weapon is given to player
function onInit( )
_SWEPSetSound( MyIndex, "single_shot", "Weapon_M249.Single" )
end
-- This is called every frame
function onThink( )
end
-- This is called when the player presses his primary fire button. This does nothing in this
-- implementation, as gmod takes care of simple fire routines. You'll only need to implement
-- this if you wish to do something more exciting (i.e. fire a rocket, launch a grenade...)
function onPrimaryAttack( )
end
-- Same as above
function onSecondaryAttack( )
end
-- Return true if you want it to reload successfully
function onReload( )
return true;
end
-- Set this to true if you want the gun on the right side of your view.
-- False if you want it on the left.
function getWeaponSwapHands()
return true;
end
-- Sets the player's Field of View while using this weapon.
function getWeaponFOV()
return 100;
end
-- Slot number for the new weapon
-- 0 = crowbar/grav gun
-- 1 = pistol/357
-- 2 = smg/pulse rifle
-- 3 = shotgun/crossbow
-- 4 = genade/rpg
-- 5 = bugbait
function getWeaponSlot()
return 1;
end
-- Position of weapon in the slot. If it is in the same slot position of another gun it will
-- not show up.
function getWeaponSlotPos()
return 3;
end
-- Just guess what this does.
function getFiresUnderwater()
return false;
end
-- Reload after every shot? (like the crossbow)
function getReloadsSingly()
return false;
end
-- how much damage the bullet does
function getDamage()
return 5;
end
-- Delay between shots (in seconds)
function getPrimaryShotDelay()
return 0.5;
end
-- Delay between shots for secondary fire (in seconds)
function getSecondaryShotDelay()
return 0.3;
end
-- Automatic weapon
function getPrimaryIsAutomatic()
return true;
end
-- Automatic weapon for secondary fire
function getSecondaryIsAutomatic()
return true;
end
-- Ammo type for primary fire
function getPrimaryAmmoType()
return "pistol";
end
-- Ammo type for secondary fire
function getSecondaryAmmoType()
return "pistol";
end
-- Max Clip size. -1 if no clip
function getMaxClipPrimary()
return 250;
end
-- Max Clip size for secondary fire. -1 if no clip
function getMaxClipSecondary()
return 250;
end
-- Primary Ammo given to player when given the gun
function getDefClipPrimary()
return 200;
end
-- Secondary Ammo given to player when given the gun
function getDefClipSecondary()
return 200;
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 0;
end
-- see above
function getSecondaryScriptOverride()
return 0;
end
-- Higher the # the bigger the spread
function getBulletSpread()
return vector3( 0.01, 0.01, 0.01 );
end
-- amount of view kick
function getViewKick()
return vector3( 0, 0.0, 0.0);
end
-- same as above only random values (set to 0.0 , 0.0, 0.0 for no random kick)
function getViewKickRandom()
return vector3( 2.0, 1.0, 1.0 );
end
-- Defines the first person model
function getViewModel( )
return "models/weapons/v_pist_p228.mdl";
end
-- Defines what it looks like from 3rd person view
function getWorldModel( )
return "models/weapons/w_pist_p228.mdl";
end
-- Classname of wep. So you can use "give" for this
function getClassName()
return "weapon_lua_pistol";
end
-- getAnimPrefix - the animation prefix. one of the following:
-- pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade
function getAnimPrefix()
return "pistol";
end
-- Text you see when choosing the weapon
function getPrintName()
return "LUA Pistol";
end
dann oben bei der zeile wo
Code:
MyIndex = 0; -- Weapon's entity index.
Owner = 0; -- The player that owns this weapon
CurrentTime = 0; -- The current game time
steht muss
Code:
_OpenScript( "mods/Terror-Squad/settings/entities/lua/admins.lua" )
rein ( Das ist jetzt von meiner mod also du kannst den pfad verändern)
jetzt felht uns der code wenn jemand anderes die Waffe aufhebt das er dann getötet wird also kommt bei
Code:
-- This is called every frame
function onThink( )
muss nur noch das hier rein
Code:
function onInit( )
_SWEPSetSound( MyIndex, "single_shot", "Weapon_G3SG1.Single" )
end
so jetzt machst du noch ein ne .lua datei die benenst du in admins.lua um
und da muss dies hier stehen
Code:
admin = "DEINESTEAMUSERID"
so ich hoffe es ist etwas verständlich geworden