AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CSS] Adding new guns plugin (https://forums.alliedmods.net/showthread.php?t=343592)

cjsrk 08-09-2023 08:39

[CSS] Adding new guns plugin
 
7 Attachment(s)
This plugin can add new weapons to the game!
At present, this version of the plugin has support for legitimate CSS or v90-v92 cracked versions.

Version 1.2.0 Update:
1. Fixed a bug where the added semi-automatic sniper gun would emit wrong sound of gunfire when the scope was opened.

2. When the parent class of a new weapon is m4a1 or usp, if the full name of its silenced gunshot file is "normal gunshot filename" _silenced.wav (for example,:mk18-1_silenced.wav), the plugin will automatically fix the bug that it mistakenly plays normal gunshot in silenced state.

3. Fixed a bug where the sound of falling injuries, the sound of bullets shining, and certain physical effects (such as the sound of stepping on glass) disappeared after purchasing a new weapon.

4. Support for adding new weapons with smoke bombs or new flash bombs as parent.

The third update comes with the help of Ducheese, thanks for his contribution!



Version 1.1.0 Update:
The cstrike \ cfg \ sourcemod \ plugin.new_weapons.cfg file added an option to set the player's walking speed after acquiring a new weapon (some people reported this issue). Range: 1.0 (the default speed of the game) - 1.5. The default setting is 1.1, which increases player movement speed by 10% after using new weapons.

Features:
1. The plugin supports the addition of up to 255 main weapons and 255 pistols. And the plugin also supports adding new grenades or knifes.

2. The plugin contains two configuration files. A File can be set to enable/disable, set the uniform buy time limit. The other file stores new guns data, can set the new weapon's sound, ammo, damage value, accuracy and purchase price.

3. The plugin supports graphical menu to buy new weapons (i.e., B-key menu).

4. The plugin can cooperate with my bot using new guns plugin, so that the bots can also use new guns.

5. In addition, I provide a special plugin smx to accommodate the ZombieReloaded plugin.

The specific use method can be seen in the compression package of several instructions.

Effect display:
https://m.youtube.com/watch?v=AxfYzN-ZrKY

https://m.youtube.com/watch?v=7K_D8PbHgMM

Grey83 08-10-2023 08:22

Re: [CSS] Adding new guns plugin
 
Rewrote the previous version of this plugin a few days ago: link.
cjsrk, you can use this code to improve your plugin.

Changes:
  • Added weapon menu (command sm_new_weapons) with prices. Only alive players can use this menu, until the time set by the sm_allow_buytime cvar expires.Like the sm_%weaponname% command.
  • Transferred the storage of weapon settings from static arrays to StringMap (RAM savings).
  • About incorrectly filled lines in the configs/NewWeaponsInfo.txt settings file, the plugin will write to the error log indicating the line number (the number starts from 1).
  • Added checks for duplicates (if the weapon has the same name, this will be recorded in the error log).
  • It will also check if the command exists on the server, before trying to add it (if it already exists, it will write about it in the error log). And it will remove the capture of non-existent plugin commands (when changing the map, it will clean and add new ones).
  • Added models and sounds will not only be cached, but also added to the download (it would also be necessary to figure out how to organize the addition of textures and other model files to the download, with an extension other than mdl).
  • Added player index checks in timers just in case.

Grey83 08-10-2023 08:25

Re: [CSS] Adding new guns plugin
 
P.S. Now the plugin has no limit on 255 weapons. =)

cjsrk 08-11-2023 05:18

Re: [CSS] Adding new guns plugin
 
Thank you for your improvement.

Grey83 08-18-2023 12:13

Re: [CSS] Adding new guns plugin
 
1 Attachment(s)
On line 122, need to fix the check:
|| TrimString(data[0]) || TrimString(data[1]))
==>
|| !TrimString(data[0]) || !TrimString(data[1]))
Due to this error, the config will not be read

This and other fixes:

Nexerade 04-01-2024 09:50

Re: [CSS] Adding new guns plugin
 
Fixed broken money/price code.
Old code:
Code:

int price, money = GetEntProp(client, Prop_Send, "m_iAccount");
if(hPrice.GetValue(weapon, money) && (money -= price) >= 0)
{
        PrintToChat(client, "Not enough money to buy.");
        if(menu) hMenu.Display(client, MENU_TIME_FOREVER);
        return;
}

New code:
Code:

int money = GetEntProp(client, Prop_Send, "m_iAccount");
int price = 0;
if(hPrice.GetValue(weapon, price) && ((money -= price) < 0))
{
        PrintToChat(client, "Not enough money to buy.");
        if(menu) hMenu.Display(client, MENU_TIME_FOREVER);
        return;
}

I made a weapon following tutorial, including decompiling/recompiling weapon to include new sounds.
However, script doesn't seem to work correctly and there are bunch of issues present:

1) When reloading/shooting, for 1 frame there is default weapon visible flickering.
2) There are no new sounds for firing.
3) There are no sounds for reloading/other sounds.
4) Silenced weapon have default world model weapon.

cjsrk 04-09-2024 13:29

Re: [CSS] Adding new guns plugin
 
Quote:

Originally Posted by Nexerade (Post 2820438)
Fixed broken money/price code.
Old code:
Code:

int price, money = GetEntProp(client, Prop_Send, "m_iAccount");
if(hPrice.GetValue(weapon, money) && (money -= price) >= 0)
{
        PrintToChat(client, "Not enough money to buy.");
        if(menu) hMenu.Display(client, MENU_TIME_FOREVER);
        return;
}

New code:
Code:

int money = GetEntProp(client, Prop_Send, "m_iAccount");
int price = 0;
if(hPrice.GetValue(weapon, price) && ((money -= price) < 0))
{
        PrintToChat(client, "Not enough money to buy.");
        if(menu) hMenu.Display(client, MENU_TIME_FOREVER);
        return;
}

I made a weapon following tutorial, including decompiling/recompiling weapon to include new sounds.
However, script doesn't seem to work correctly and there are bunch of issues present:

1) When reloading/shooting, for 1 frame there is default weapon visible flickering.
2) There are no new sounds for firing.
3) There are no sounds for reloading/other sounds.
4) Silenced weapon have default world model weapon.

1. I have been using this improved version of the plug-in for a long time, and I have never seen the flickering phenomenon at all. I really don’t know what is going on in your case.

2. Questions about sound. Please check that you have declared the new weapon's sound text file in the first game_sounds_manifest.txt.
For example:
"preload_file" "scripts/weapons/an94.txt"

CassieK 04-17-2024 01:28

Re: [CSS] Adding new guns plugin
 
Im Having A Few Issues,I Downloaded The Required Plugins And Yours Of Course,I Tried The Included MPX And It Works,I See It In The Buy Menu In The Console And In Game, But When The Gun Spawns I Keep Getting Some Sort Of Server Lag Until I Die,And This Shows Up In The Console.

FCVAR_CLIENTCMD_CAN_EXECUTE prevented running command: sm_mpx
Unknown command: sm_mpx
Shutdown 6 predictable entities and 0 client-created entities

Once I Die The Wierd Lag Goes Away. By Wierd Server Lag I Mean Like That Odd Movement Like If Your Connected To A Server Really Far Away, Clicks And Button Presses Being Delayed,That Sorta Stuff

cjsrk 04-18-2024 13:25

Re: [CSS] Adding new guns plugin
 
Quote:

Originally Posted by CassieK (Post 2821053)
Im Having A Few Issues,I Downloaded The Required Plugins And Yours Of Course,I Tried The Included MPX And It Works,I See It In The Buy Menu In The Console And In Game, But When The Gun Spawns I Keep Getting Some Sort Of Server Lag Until I Die,And This Shows Up In The Console.

FCVAR_CLIENTCMD_CAN_EXECUTE prevented running command: sm_mpx
Unknown command: sm_mpx
Shutdown 6 predictable entities and 0 client-created entities

Once I Die The Wierd Lag Goes Away. By Wierd Server Lag I Mean Like That Odd Movement Like If Your Connected To A Server Really Far Away, Clicks And Button Presses Being Delayed,That Sorta Stuff

Closing client predictions does have an impact on client latency, especially when online. But if I don't, the new weapons will be constantly flashing and difficult to use.

bestearl 06-02-2024 04:17

Re: [CSS] Adding new guns plugin
 
Kan Dao Zhong Wen Bei Zhu Zhen Qin Qie ,Cha Jian Xie De Bu Cuo 。Lao Xiang 666


All times are GMT -4. The time now is 11:04.

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