Raised This Month: $51 Target: $400
 12% 

weapon system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Usama Ali
Member
Join Date: Apr 2020
Old 05-04-2022 , 21:53   weapon system
Reply With Quote #1

can someone find or make me a plugin which unlocks weapon with levels. for example
1: m4a1

next level: ak47

and also i can add more weapons to it (eg Golden weapons)
Usama Ali is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 05-05-2022 , 01:48   Re: weapon system
Reply With Quote #2

i wont
bigdaddy424 is offline
Usama Ali
Member
Join Date: Apr 2020
Old 05-06-2022 , 11:42   Re: weapon system
Reply With Quote #3

Quote:
Originally Posted by bigdaddy424 View Post
i wont
dude this much hate?
Usama Ali is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-06-2022 , 12:24   Re: weapon system
Reply With Quote #4

Quote:
Originally Posted by Usama Ali View Post
can someone find or make me a plugin which unlocks weapon with levels. for example
1: m4a1

next level: ak47

and also i can add more weapons to it (eg Golden weapons)
You got few choice:
1. NST Weapon: An acient weapon system but it still serve it purpose and can easily add alot of weapon, just not weapon with effect like Balrog, Hunter Killer,...
2. GunXP: It is more on get money to unlock but it should work with level if modifined abit
3. Mileage Weapon: This one made by Dias and it have level restriction implemented but you have to had a level system (OciXCrom's Rank System for example), check the level with it to make it work.

TLDR: There ain't any choice without modifiding some existed one
__________________
My plugin:
Celena Luna is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 05-06-2022 , 21:42   Re: weapon system
Reply With Quote #5

Quote:
Originally Posted by Usama Ali View Post
dude this much hate?
That's not hate, it's lack of knowledge.
bigdaddy424 is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-06-2022 , 22:14   Re: weapon system
Reply With Quote #6

Untested:

Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <cromchat>
#include <crxranks>
#include <hamsandwich>

new const Version[ ] = "1.0";

enum eWeaponSkins
{
	WeaponID,
	Weapon_Name[ 64 ],
	Weapon_vSkin[ 64 ],
	Weapon_pSkin[ 64 ],
	Weapon_Level
}

new const g_szSkinsWeapon[ ][ eWeaponSkins ] = {
	{ CSW_KNIFE, "weapon name", "models/v_knife_r.mdl", "", 5 }, // models/model.mdl
	{ CSW_M3, "weapon name two", "", "", 10 },
	{ CSW_M249, "weapon name three", "", "", 15 },
	{ CSW_M4A1, "weapon name four", "", "", 20 },
	{ CSW_MAC10, "weapon name five", "", "", 25 }
}

	
new g_iItems[ MAX_PLAYERS + 1 ], g_iMenuCallback;

public plugin_init() 
{
	register_plugin( "Weapons System", Version, "Supremache" );
	register_cvar( "Weapons System", Version, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED );
	
	CC_SetPrefix( "^4[Weapons System]" )
	
	g_iMenuCallback = menu_makecallback( "WeaponsMenu_Callback" );
	
	for( new i = 0 ; i < sizeof g_szSkinsWeapon ; i++  )
	{
		if( g_szSkinsWeapon[ i ][ Weapon_vSkin ][ 0 ] != EOS || g_szSkinsWeapon[ i ][ Weapon_pSkin ][ 0 ] != EOS )
		{
			RegisterHam( Ham_Item_Deploy, g_szSkinsWeapon[ i ][ WeaponID ], "OnSelectWeapon", 1 )
		}
	}
	
	register_clcmd( "say /wpn" , "@WeaponMenu" );
}

public client_connect( id )
{
	g_iItems[ id ] = 0;
}

public plugin_precache( )
{
	for( new i = 0 ; i < sizeof g_szSkinsWeapon ; i++  )
	{
		if( g_szSkinsWeapon[ i ][ Weapon_vSkin ][ 0 ] != EOS )
		{
			precache_model( g_szSkinsWeapon[ i ][ Weapon_vSkin ] )
		}
		
		if( g_szSkinsWeapon[ i ][ Weapon_pSkin ][ 0 ] != EOS )
		{
			precache_model( g_szSkinsWeapon[ i ][ Weapon_pSkin ] )
		}
	}
}

@WeaponMenu( id )
{
	new szData[ 64 ], szID[ 3 ], iMenu = menu_create( "\yWeapon Menu:", "@WeaponHandler" );

	for( new i; i < sizeof g_szSkinsWeapon; i++ )
	{
		if( crxranks_get_user_level( id ) < g_szSkinsWeapon[ i ][ Weapon_Level ] )
		{
			formatex( szData, charsmax( szData ), "%s \y%i \r(Lv:%i)", g_szSkinsWeapon[ i ][ Weapon_Name ], g_szSkinsWeapon[ i ][ Weapon_Level ], g_szSkinsWeapon[ i ][ Weapon_Level ] )
		}
		else
		{
			formatex( szData, charsmax( szData ), "%s \y%i", g_szSkinsWeapon[ i ][ Weapon_Name ], g_szSkinsWeapon[ i ][ Weapon_Level ] )
		}
		num_to_str( i, szID, charsmax( szID ) );
		menu_additem( iMenu, szData, szID, _, g_iMenuCallback );
	}
	menu_display( id, iMenu )
	return PLUGIN_HANDLED;
}

@WeaponHandler( id, iMenu, iItem )
{
	if( iItem != MENU_EXIT ) 
	{
		if( !is_user_alive( id ) )
		{
			CC_SendMessage( id, "You should be alive to buy this item" );
			goto @Destroy;
		}

		static szData[ 10 ], iUnused;
		menu_item_getinfo( iMenu, iItem, iUnused, szData, charsmax(szData), .callback = iUnused )
		g_iItems[ id ] = str_to_num( szData );
		
		if( get_user_weapon( id ) == g_szSkinsWeapon[ g_iItems[ id ] ][ WeaponID ] )
		{
			RefreshWeaponModel( id );
		}
		
		CC_SendMessage( id, "You were given skin %s", szData );
	}
	@Destroy:
	menu_destroy( iMenu );
	return PLUGIN_HANDLED;
	
}

public WeaponsMenu_Callback( id, iMenu, iItem ) 
 {
	static szData[ 10 ], iUnused;
	menu_item_getinfo( iMenu, iItem, iUnused, szData, charsmax(szData), .callback = iUnused )
	new iItemID = str_to_num( szData );
	
	return ( crxranks_get_user_level( id ) < g_szSkinsWeapon[ iItemID ][ Weapon_Level ] ) ? ITEM_DISABLED : ITEM_IGNORE; 
}

public OnSelectWeapon( iEnt )
{
	new id = get_pdata_cbase( iEnt, 44, 4 )
	
	if( is_user_connected( id ) )
	{
		RefreshWeaponModel( id )
	}
}

RefreshWeaponModel( const id )
{
	if( g_szSkinsWeapon[ g_iItems[ id ] ][ Weapon_vSkin ][ 0 ] != EOS )                        
		set_pev( id, pev_viewmodel2, g_szSkinsWeapon[ g_iItems[ id ] ][ Weapon_vSkin ] )

	if( g_szSkinsWeapon[ g_iItems[ id ] ][ Weapon_pSkin ][ 0 ] != EOS )
		set_pev( id, pev_weaponmodel2, g_szSkinsWeapon[ g_iItems[ id ] ][ Weapon_pSkin ] )
}
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 05-09-2022 at 02:39.
Supremache is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-08-2022 , 21:02   Re: weapon system
Reply With Quote #7

@Supremache: You shouldn't change model in CurWeapon. Set it in HamDeploy is much more efficient.
__________________
My plugin:
Celena Luna is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-09-2022 , 00:52   Re: weapon system
Reply With Quote #8

I know HamDeploy is better but this plugin was created before to test something and I made some edits for this request.
Anyways, I did it
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:03.


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