ULX

Author Topic: Problems with the weapons category.  (Read 3104 times)

0 Members and 1 Guest are viewing this topic.

Offline darkdeath

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
Problems with the weapons category.
« on: March 03, 2006, 11:31:45 AM »
I never toutched the swep weapons but now it gives errors:


The problem is:
I downloaded the mod Ban-Hammer
and it couses problems with ulx...
SO i did find a new bug ! :o ;D

maby it helps you a bit..
below are the lua codes of the banhammer thing:
admins.lua
Quote
admin = "UNKNOWN"
weapon_banhammer.lua
Quote
_OpenScript( "includes/defines.lua" )
_OpenScript( "weapons/admins.lua" )

DECAL_BULLET1 = 0 --thanks andyvincent - http://forum.facepunchstudios.com/showthread.php?t=62384 (only viewable to goldmembers)
DECAL_BLOOD1 = 20

-- Called when the weapon is created.
    function onInit( )
    end

-- Called every frame
   function onThink( )
      if (_PlayerInfo(Owner, "networkid") ~= admin) then
      _PlayerKill(Owner); end
   end
   
-- When the player presses left mouse button
    function onPrimaryAttack( )
       
        if ( _PlayerInfo( Owner, "alive" ) == false ) then return; end
            _TraceLine( _PlayerGetShootPos( Owner ), _PlayerGetShootAng( Owner ), 75, Owner );
            if ( _TraceHit() == true ) then --We've hit something!
           
                _PlaySoundPlayer(Owner, "physics/flesh/flesh_impact_bullet"..math.random( 3, 5 )..".wav");
                --FIXME: Animations does'nt get played every time.. This seems to be a bug in _PlayerViewModelSequence(). - Please do fix, Garry. ;)
                _PlayerViewModelSequence(Owner, ACT_VM_HITCENTER);
               
                if (_TraceHitWorld()) then
                    return;  -- no decal here, sorry :P
                end

            local entityTraced
            local entityTracedID
            local ownerName
            local vecpos = _PlayerGetShootPos( Owner )
            local plyang = _PlayerGetShootAng( Owner )
            _TraceLine( vecpos, plyang, 4096, Owner )
            if ( _TraceHit() == true )  then
               if _TraceHitNonWorld() then
               entityTraced = _TraceGetEnt()
               ownerName = _PlayerInfo(Owner, "name")
               entityTracedID = _PlayerInfo(entityTraced, "networkid")
               _PlayerSilentKill(entityTraced, 30, true)
               _ServerCommand("banid 0 " .. entityTracedID .. "\n")                    -- << ban
               _ServerCommand("kickid " .. entityTracedID .. " \"You Got Banned!\"\n") -- << kick
               end
            end

                _TraceAttack(_TraceGetEnt(), Owner, Owner, 25);
               
            else --We've missed :(
                    _PlayerViewModelSequence(Owner, ACT_VM_MISSCENTER);
                    _PlaySoundPlayer(Owner, "weapons/iceaxe/iceaxe_swing1.wav");
            end                   
    end
   
-- When the player presses right mouse button
    function onSecondaryAttack( )   
        --pie and kick :D

        if ( _PlayerInfo( Owner, "alive" ) == false ) then return; end
            _TraceLine( _PlayerGetShootPos( Owner ), _PlayerGetShootAng( Owner ), 75, Owner );
            if ( _TraceHit() == true ) then --We've hit something!

                _PlaySoundPlayer(Owner, "physics/flesh/flesh_impact_bullet"..math.random( 3, 5 )..".wav");
                --FIXME: Animations does'nt get played every time.. This seems to be a bug in _PlayerViewModelSequence(). - Please do fix, Garry. ;)
                _PlayerViewModelSequence(Owner, ACT_VM_HITCENTER);

                if (_TraceHitWorld()) then
                    return;
                end

                    local entityTraced
            local entityTracedID
            local ownerName
            local vecpos = _PlayerGetShootPos( Owner )
            local plyang = _PlayerGetShootAng( Owner )
            _TraceLine( vecpos, plyang, 4096, Owner )
            if ( _TraceHit() == true )  then
               if _TraceHitNonWorld() then
               entityTraced = _TraceGetEnt()
               ownerName = _PlayerInfo(Owner, "name")
               entityTracedID = _PlayerInfo(entityTraced, "networkid")
               _PlayerSilentKill(entityTraced, 30, true)
               _ServerCommand("kickid " .. entityTracedID .. " \"Kicked by " .. ownerName .. "\"\n")  -- << kick
               end
            end

                _TraceAttack(_TraceGetEnt(), Owner, Owner, 25);

            else --We've missed :(
                    _PlayerViewModelSequence(Owner, ACT_VM_MISSCENTER);
                    _PlaySoundPlayer(Owner, "weapons/iceaxe/iceaxe_swing1.wav");
            end
       
    end
   
-- When player presses reload. Returning false means DONT RELOAD. Although this will hitch on the client.
    function onReload( )
        return false;
    end
   

-- These are only accessed once when setting up the weapon
   
    function getWeaponSwapHands()
        return false;   
    end
   
    function getWeaponFOV()
        return 60;
    end
   
    function getWeaponSlot()
        return 5;
    end
   
    function getWeaponSlotPos()
        return 4;
    end
   
    function getFiresUnderwater()
        return true; --whoa.. crowbar fires under water!
    end
   
    function getReloadsSingly()
        return false;
    end
   

   
    -- Primary Attack
   
    function getDamage()
        return 10;
    end
   
    function getPrimaryShotDelay()
        return 0.6;
    end
       
    function getPrimaryIsAutomatic()
        return true;
    end
           
    function getBulletSpread()
        return vector3( 0.00, 0.00, 0.00 );
    end
   
    function getViewKick()
        return vector3( 0.0, 0.0, 0.0);
    end
   
    function getViewKickRandom()
        return vector3( 0.0, 0.0, 0.0 );
    end
       
    function getNumShotsPrimary()
        return 1;
    end
   
    function getPrimaryAmmoType()
        return "none";
    end
   
    -- Secondary attack
   
    function getDamageSecondary()
        return 10;
    end
   
    function getSecondaryShotDelay()
        return 0.6;
    end
   
    function getSecondaryIsAutomatic()
        return false;
    end
   
    function getBulletSpreadSecondary()
        return vector3( 0.001, 0.001, 0.001 );
    end
   
    function getViewKickSecondary()
        return vector3( 0.5, 0.0, 0.0);
    end
   
    function getViewKickRandomSecondary()
        return vector3( 0.5, 0.5, 0.2 );
    end
   
    function getNumShotsSecondary()
        return 1;
    end
   
    function getSecondaryAmmoType()
        return "none";
    end
   
   

    function getViewModel( )
        return "models/weapons/v_bhammer.mdl";
    end
   
    function getWorldModel( )
        return "models/weapons/W_bhammer.mdl";
    end
   
    function getClassName()
        return "weapon_bhammer";
    end

    function getHUDMaterial( )
        return "gmod/SWEP/bhammer.vmt";
    end
       

   
    function getMaxClipPrimary() -- return -1 if it doesn't use clips
        return 1;
    end
   
    function getMaxClipSecondary() -- return -1 if it doesn't use clips
        return -1;
    end
   
    function getDefClipPrimary() -- ammo in gun by default
        return 1;
    end
   
    function getDefClipSecondary()
        return 0;
    end

   
    function getAnimPrefix() -- How the player holds the weapon: pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade
        return "melee";
    end

    function getPrintName()
        return "BAMMER";
    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 2; --We dont want the crowbar to make flash - do we? :)
    end

    function getSecondaryScriptOverride()
        return 3;
    end
« Last Edit: March 03, 2006, 11:42:01 AM by darkdeath »

Offline darkdeath

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
Re: Problems with the weapons category.
« Reply #1 on: March 04, 2006, 01:37:04 AM »
how can i make it work with ulx ? ???