Ergebnis 1 bis 1 von 1

Thema: Die idee des Ammo Refillers

  1. #1

    Standard Die idee des Ammo Refillers

    Hallo erst mal.

    Ich bin MrFaul und das mein erster Eintrag also bombardiert mich nich mit Kritik wenn ich was falsch mache:

    Nun folgendes ich hatte die Idee ein SWEP zu erstellen das in der Lage ist Ammo Armor Health in Ammo Armor Health umzuwandeln bin auch so weit gekommen das ich die groben Skript Fehler ausgemerzt habe und ich das ding Spawnen kann es funktioniert auch wunderbar wenn ich die ammo/was auch immer, Typen einzeln im Skript festlege was aller dings nicht wirklich hilfreich ist das es ja alle arten von Ammo..... umwandeln soll.

    Habs also mit Tabeln versucht wollte er auch nicht,
    Hab dann direkt in die Funktionen die die Art der "was auch immer" bestimmen die einzelnen arten gesetzt.
    Also im großen und ganzen bin ich einfach zu dumm/unaufmerksam Parameter zu übergeben.

    Wär nett wenn mir einer helfen könnte danke


    Code:
    if ( SERVER ) then
    
    	AddCSLuaFile( "shared.lua" )
    	
    	SWEP.HoldType			= "phys"
    	
    end
    
    if CLIENT then
    	SWEP.PrintName			= "Ammo refiller"			
    	SWEP.Author			    = "Mr.Faul"
    	SWEP.Contact			= "[email protected]"
    	SWEP.Purpose			= "Ammo refiller alpha"
    	SWEP.Instructions		= "Converts energy ammo or health in everything you need"
    	SWEP.Slot			    = 2
    	SWEP.SlotPos			= 6
    	SWEP.ViewModelFlip		= false
    	SWEP.ViewModelFOV		= 60
    end
    
    SWEP.Spawnable			= true
    SWEP.AdminSpawnable		= true
    SWEP.ViewModel			= "models/weapons/v_superphyscannon.mdl"
    SWEP.WorldModel			= "models/weapons/w_physics.mdl"
    SWEP.Weight			    = 5
    SWEP.AutoSwitchTo		= false
    SWEP.AutoSwitchFrom		= false
    
    SWEP.Primary.ClipSize		= -1
    SWEP.Primary.DefaultClip	= -1
    SWEP.Primary.Automatic		= true
    SWEP.Primary.Ammo		    = ammol_primary
    
    SWEP.Secondary.ClipSize		= -1
    SWEP.Secondary.DefaultClip	= -1
    SWEP.Secondary.Automatic	= false
    SWEP.Secondary.Ammo	    	= ammol_secondary
    
    function primary(p)
    if !SERVER then return end
    local ammol_primary = {}
    local ammol_primary_count = {}
        if(p == 1) then ammol_primary = "AR2"; ammol_primary_count = 60;
        elseif(p == 2) then ammol_primary = "AlyxGun"; ammol_primary_count = 150;
        elseif(p == 3) then ammol_primary = "Pistol"; ammol_primary_count = 150;
        elseif(p == 4) then ammol_primary = "SMG1"; ammol_primary_count = 225;
    	elseif(p == 5) then ammol_primary = "357"; ammol_primary_count = 12;
    	elseif(p == 6) then ammol_primary = "XBowBolt"; ammol_primary_count = 10;
    	elseif(p == 7) then ammol_primary = "Buckshot"; ammol_primary_count = 30;
    	elseif(p == 8) then ammol_primary = "RPG_Round"; ammol_primary_count = 3;
    	elseif(p == 9) then ammol_primary = "SMG1_Grenade"; ammol_primary_count = 3;
    	elseif(p == 10) then ammol_primary = "SniperRound"; ammol_primary_count = 20;
    	elseif(p == 11) then ammol_primary = "SniperPenetratedRound"; ammol_primary_count = 20;
    	elseif(p == 12) then ammol_primary = "AR2AltFire"; ammol_primary_count = 3;
        end
    	return ammol_primary_count, ammol_primary;
    end
    
    function secondary(s)
    if !SERVER then return end
    local ammol_secondary = {}
    local ammol_secondary_count = {}
        if(s == 1) then ammol_secondary = "AR2"; ammol_secondary_count = 60;
        elseif(s == 2) then ammol_secondary = "AlyxGun"; ammol_secondary_count = 150;
        elseif(s == 3) then ammol_secondary = "Pistol"; ammol_secondary_count = 150;
        elseif(s == 4) then ammol_secondary = "SMG1"; ammol_secondary_count = 225;
    	elseif(s == 5) then ammol_secondary = "357"; ammol_secondary_count = 12;
    	elseif(s == 6) then ammol_secondary = "XBowBolt"; ammol_secondary_count = 10;
    	elseif(s == 7) then ammol_secondary = "Buckshot"; ammol_secondary_count = 30;
    	elseif(s == 8) then ammol_secondary = "RPG_Round"; ammol_secondary_count = 3;
    	elseif(s == 9) then ammol_secondary = "SMG1_Grenade"; ammol_secondary_count = 3;
    	elseif(s == 10) then ammol_secondary = "SniperRound"; ammol_secondary_count = 20;
    	elseif(s == 11) then ammol_secondary = "SniperPenetratedRound"; ammol_secondary_count = 20;
    	elseif(s == 12) then ammol_secondary = "AR2AltFire"; ammol_secondary_count = 3;
        end
    	return ammol_secondary, ammol.secondary_count;
    end
    
    function SWEP:Reload()
         if !SERVER then return end
         if(primary(p) > 12 or primary(p) <= 0) then primary(p=1) else
    	 primary(p + 1) end
        return primary(p)
    end
    
    
    
    function SWEP:PrimaryAttack( )
    	self.Weapon:SetNextPrimaryFire( CurTime( ) + .2 )
    	if !SERVER then return end
    	local pc = ammol_primary_count
    	local sc = ammol_secondary_count
    	local r = 0
    	local g = 0
    	if(pc > sc) then
    	r = math.ceil(pc/sc)
    	g = 1
    	else
    	g = math.floor(sc/pc)
    	r = 1
    	end
    	if(ammo.primary() > r) then
    	self.Owner:RemoveAmmo (r, ammol_primary)
    	self.Owner:GiveAmmo(g, ammol_secondary);
    	else return end
    
    end  	
    
    function SWEP:SecondaryAttack( )
    	 if !SERVER then return end
    	 if (secondary() > 12 or secondary() <= 0) then secondary(1) else
    	 secondary(secondary() + 1) end
        return secondary()
    end
    
    local weaponl = {"AR2",
    "AlyxGun",
    "Pistol",
    "SMG1",  
    "357",   
    "XBowBolt",	   
    "Buckshot",
    "RPG_Round",
    "SMG1_Grenade",
    "SniperRound",
    "SniperPenetratedRound",
    "AR2AltFire"}
    --[[
     # AR2 :60- Ammunition of the AR2/Pulse Rifle
    #  AlyxGun:?
    #  Pistol :150- Ammunition of the 9MM Pistol
    #  SMG1:225 - Ammunition of the SMG/MP7
    #  357:12- Ammunition of the .357 Magnum
    #  XBowBolt:10 - Ammunition of the Crossbow
    #  Buckshot :30- Ammunition of the Shotgun
    #  RPG_Round:3 - Ammunition of the RPG/Rocket Launcher
    #  SMG1_Grenade:3 - Ammunition for the SMG/MP7 grenade launcher (secondary fire)
    #  SniperRound:20
    #  SniperPenetratedRound:20
    #  Grenade - Note you must be given the grenade weapon (e.g. pl:Give ("weapon_grenade")) before you can throw any grenades
    #  Thumper - Ammunition cannot exceed 2
    #  Gravity
    #  Battery
    #  GaussEnergy
    #  CombineCannon
    #  AirboatGun
    #  StriderMinigun
    #  HelicopterGun
    #  AR2AltFire:3 - Ammunition of the AR2/Pulse Rifle 'combine ball' (secondary fire)
    #  slam - See Grenade ]]--
    Danke schon mal im voraus für gute ratschläge
    Doppelpost-Edit:
    Was ich noch hinzufügen wollte das is ne sehr frühe Version die Benutzerfreundlichkeit kommt später wenn die grund funktionen stehen!
    Geändert von MrFaul (06.03.2008 um 13:39 Uhr) Grund: Doppelposts autom. zusammengefügt

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •