AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Counter-Strike Weapon Mod [1.7.1] (https://forums.alliedmods.net/showthread.php?t=308229)

DarthMan 08-16-2018 12:28

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by Ghosted (Post 2596432)
Description
Presenting You Counter-Strike Weapon Mod. This Module Allows Uou To Add Infinite Amount of Weapons Into Game. Usually Such Things Are Used In Zombie Mods, But You Can Use This One On Classic Mode If You Want :) . CSWM Created Using Following Projects SDKs:

  1. ReGameDLL_CS
  2. AMX MOD X
  3. MetaMod

→ Credits Goes To These Projects Authors

______________________________________

  • No Weapon Limit
  • Over 9 Attack2 Modes
  • Over 17 New Ammos Can Be Adeded
  • Only Resources Required & Low Experience of Scripting
  • You Can Download Source Code From Here
  • Or Report An Issue


Tutorial
  • Creating Weapon
    Code:

            new Weapon = CreateWeapon(<Model Name>, <Type>, <Name>);
  • Editing/Defining Parameters
    • Deploy
      Code:

              BuildWeaponDeploy(<Weapon>, <Animation [-1 = Auto Detect]>, <Duration [0.0 = Auto Detect]>);
    • Shoot
      Code:

              BuildWeaponPrimaryAttack(<Weapon>, <Delay>, <Damage>, <Recoil>, <Animation [-1 = Auto Detect (Alle)]> ...);
    • Reload Style of Pistol/Rifle/Sniper
      Code:

              BuildWeaponReload(<Weapon>, <Animation [-1 = Auto Detect]>, <Duration [0.0 = Auto Detect]>);
    • Reload Style of Shotgun (Uses Default Animation Indexes)
      Code:

              BuildWeaponReload2(<Weapon>, <Duration [Insert Time]>, <Style [M3/XM1014]>);
    • Models
      Code:

              BuildWeaponModels(<Weapon>, <View Model>, <Weapon Model>, <World Model>);
    • Ammo
      Code:

              BuildWeaponAmmunition(<Weapon>, <Clip>, <Type>);
    • Fire Sound
      Code:

              BuildWeaponFireSound(<Weapon>, <Sound>);
    • Weapon List (HUD)
      Code:

              BuildWeaponList(<Weapon>, <WeaponList Name>);
    • Flags
      Code:

              BuildWeaponFlags(<Weapon>, <Flag Bitsum>);


Where's Secondary Attack Functions? They Are Not Done Yet :crab:

Requirements
↪ MetaMod
↪ AMX MOD X


How To Use
Enable 'sv_cheats' (Restart The Game) & Type 'give *', Where * Is Model Name of The Weapon Or Create Your Own Weapons Menu Using This Source Code.


Author
It's Me (Ghost)


Platforms
At This Time > Windows Only


How To Install
First Download [Direct Link], Then Add 'cswm' in 'modules.ini'.


Examples

Does this support adding entirely new weapons to CS on slots? By that I mean having all of the old weapons plus the new ones. Also, is ReHLDS a must?

Ghosted 08-16-2018 14:00

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by DarthMan (Post 2610553)
Does this support adding entirely new weapons to CS on slots? By that I mean having all of the old weapons plus the new ones. Also, is ReHLDS a must?

No need to quote whole post. No you cant have all old ones and new ones holding at once. No you don't need reHLDS/reGameDLL.

Airkish 09-08-2018 01:59

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Tried to build some weapons from cs:go, then noticed it's windows only :/ Can we expect linux support?
And what will get_user_weapon(id) return when I've selected custom weapon?

Ghosted 09-08-2018 05:17

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by Airkish (Post 2614230)
Tried to build some weapons from cs:go, then noticed it's windows only :/ Can we expect linux support?

I'l try.
EDIT: I think compiling on windows to get linux library is impssible.

Quote:

Originally Posted by Airkish (Post 2614230)
And what will get_user_weapon(id) return when I've selected custom weapon?

Will return Pistol as P228, Rifle as AK47, Sniper as AWP, Shotgun as XM1014

Airkish 09-08-2018 05:20

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by Ghosted (Post 2614236)
Will return Pistol as P228, Rifle as AK47, Sniper as AWP, Shotgun as XM1014

Would it be possible for you to let us set custom id?

PHP Code:

new Weapon CreateWeapon(<Model Name>, <Type>, <Name>, <Index>); 


Ghosted 09-08-2018 06:02

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by Airkish (Post 2614237)
Would it be possible for you to let us set custom id?

PHP Code:

new Weapon CreateWeapon(<Model Name>, <Type>, <Name>, <Index>); 


no, there is limit of weapon index - 32 (MAX_WEAPONS) which is already filled up.
things would mess up.

hjkwe654 09-09-2018 01:45

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
CSWM will conflict with other plugins and cause server crash

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <rpgx>

#define dmgcalc (0.04 * RPGx_GetUpgradeLevel(attacker, upgrade_id))

new g_hambots
new cvar_botquota
new upgrade_id

public plugin_init() {
    
register_plugin("Knife Dmg+ RPGx Upgrade""2.7""hjkwe654")
    
cvar_botquota get_cvar_pointer("bot_quota")
    
RegisterHam(Ham_TakeDamage"player""KnifeDamage")
}

public 
client_putinserver(id) {
    if (!
is_user_bot(id) && g_hambots && !cvar_botquota)
        return
    
    
set_task(0.1"fw_RegisterHamBots"id)
}

public 
fw_RegisterHamBots(id) {
    
RegisterHamFromEntity(Ham_TakeDamageid"KnifeDamage_BOT")
    
g_hambots true
}

public 
RPGx_OnPluginReady()
    
upgrade_id RPGx_MakeUpgrade("近戰訓練"100157)

public 
KnifeDamage(thisidattackerFloat:fDmgdamagebits) {
    if(
is_user_alive(attacker)){
        new 
iLevel RPGx_GetUpgradeLevel(attackerupgrade_id)
        if(
iLevel && get_user_weapon(attacker) == CSW_KNIFE)
        {
            
SetHamParamFloat(4fDmg * (dmgcalc))   //this code will conflict with CSWM
            
return HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED
}

public 
KnifeDamage_BOT(thisidattackerFloat:fDmgdamagebits) {
    if(
is_user_alive(attacker)){
        new 
iLevel RPGx_GetUpgradeLevel(attackerupgrade_id)
        if(
iLevel && get_user_weapon(attacker) == CSW_KNIFE)
        {
            
SetHamParamFloat(4fDmg + (iLevel 0.08))   //this code will conflict with CSWM
            
return HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED



Ghosted 09-09-2018 04:49

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by hjkwe654 (Post 2614339)
CSWM will conflict with other plugins and cause server crash
Spoiler

Thanks for report, i have fixed the issue, problem was not SetHamParamFloat, it was caused after restarting the game and shooting bot.

Your code is incorrect at:
Code:

if (!is_user_bot(id) && g_hambots && !cvar_botquota)
                return

should be:
Code:

if (!is_user_bot(id) || g_hambots || !cvar_botquota)
                return

If you face any issues please report here or on github page.

hjkwe654 09-09-2018 13:28

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
One more issue, client get into buy menu will crash client side. (After update to 1.6.1)

Ghosted 09-09-2018 16:20

Re: Module: Counter-Strike Weapon Mod [1.6 R]
 
Quote:

Originally Posted by hjkwe654 (Post 2614424)
One more issue, client get into buy menu will crash client side. (After update to 1.6.1)

That should not be connected to server in any way. Anyway tested and it is not an issue.


All times are GMT -4. The time now is 21:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.