Raised This Month: $10 Target: $400
 2% 

MG Auto Weapon Plugin Counter-Strike 1.6


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mohamed Gaber
New Member
Join Date: Sep 2021
Old 09-22-2021 , 07:41   MG Auto Weapon Plugin Counter-Strike 1.6
Reply With Quote #1

Hello dude

This plugin give a random weapon for player when he spawn.

Random Weapons:
All weapons in the game.

Sometimes the plugin give player:
Ak47, m4a1, sg552 or aug + he grenade + flash bang + smoke grenade.

When the plugin give a pistol will give player shield. Excepting elites so the plugin will give he grenade.

You can change give after 4 seconds with the command 'mg_auto_weapon_seconds seconds'.

Plugin Code:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN "MG Auto Weapon"
#define VERSION "2.0"
#define AUTHOR "MG Pro"

new give_seconds

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Spawn, "player", "mg_PlayerSpawn", 1)
	
	give_seconds = register_cvar("mg_give_auto_weapon_seconds", "4")
	
}

public mg_PlayerSpawn(id){
	
	if(!is_user_alive(id)){
		
		return PLUGIN_HANDLED
		
	}
	
	set_task(get_pcvar_float(give_seconds), "GiveWeapon", id)
	
	return PLUGIN_HANDLED
	
}

public GiveWeapon(id){
	
	if(!is_user_alive(id)){
		
		return PLUGIN_HANDLED
		
	}
	
	new number=random_num(0, 28)
	
	if(number == 0){
		
		give_item(id, "weapon_ak47")
		
		cs_set_user_bpammo(id, CSW_AK47, 90)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got ak47.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4ak47 ^1.")
		
	}
	
	
	if(number == 1){
		
		give_item(id, "weapon_m4a1")
		
		cs_set_user_bpammo(id, CSW_M4A1, 90)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got m4a1.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4m4a1 ^1.")
		
	}
	
	
	if(number == 3){
		
		give_item(id, "weapon_sg552")
		
		cs_set_user_bpammo(id, CSW_SG552, 90)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got sg552.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4sg552 ^1.")
		
	}
	
	
	if(number == 4){
		
		give_item(id, "weapon_aug")
		
		cs_set_user_bpammo(id, CSW_AUG, 90)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got aug.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4aug ^1.")
		
	}
	
	
	if(number == 5){
		
		give_item(id, "weapon_galil")
		
		cs_set_user_bpammo(id, CSW_GALIL, 95)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got galil.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4galil ^1.")
		
	}
	
	
	if(number == 6){
		
		give_item(id, "weapon_famas")
		
		cs_set_user_bpammo(id, CSW_FAMAS, 95)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		//client_print(id, print_chat, "[Auto Weapon]: You got famas.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4famas ^1.")
		
	}
	
	
	if(number == 7){
		
		give_item(id, "weapon_xm1014")
		
		cs_set_user_bpammo(id, CSW_XM1014, 32)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got xm1014.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4xm1014 ^1.")
		
	}
	
	
	if(number == 8){
		
		give_item(id, "weapon_m3")
		
		cs_set_user_bpammo(id, CSW_M3, 50)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		//client_print(id, print_chat, "[Auto Weapon]: You got m3.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4m3 ^1.")
		
	}
	
	
	if(number == 9){
		
		give_item(id, "weapon_awp")
		
		cs_set_user_bpammo(id, CSW_AWP, 100)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		//client_print(id, print_chat, "[Auto Weapon]: You got awp.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4awp ^1.")
		
	}
	
	
	if(number == 10){
		
		give_item(id, "weapon_p90")
		
		cs_set_user_bpammo(id, CSW_P90, 150)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		//client_print(id, print_chat, "[Auto Weapon]: You got p90.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4p90 ^1.")
		
	}
	
	// =============== New ===============
	
	if(number == 11){
		
		give_item(id, "weapon_elite")
		
		cs_set_user_bpammo(id, CSW_ELITE, 100)
		give_item(id, "weapon_hegrenade")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got elite.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4elite + hegrenade ^1.")
	
	}
	
	
	if(number == 12){
		
		give_item(id, "weapon_deagle")
		
		cs_set_user_bpammo(id, CSW_DEAGLE, 32)
		give_item(id, "weapon_shield")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4deagle + shield ^1.")
	
	}
	
	
	if(number == 13){
		
		give_item(id, "weapon_fiveseven")
		
		cs_set_user_bpammo(id, CSW_FIVESEVEN, 120)
		give_item(id, "weapon_shield")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4fiveseven + shield ^1.")
	
	}
	
	
	if(number == 14){
		
		give_item(id, "weapon_p228")
		
		cs_set_user_bpammo(id, CSW_P228, 100)
		give_item(id, "weapon_shield")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4p228 + shield ^1.")
	
	}
	
	
	if(number == 15){
		
		give_item(id, "weapon_clock18")
		
		cs_set_user_bpammo(id, CSW_DEAGLE, 32)
		give_item(id, "weapon_shield")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4clock18 + shield ^1.")
	
	}
	
	
	if(number == 16){
		
		give_item(id, "weapon_usp")
		
		cs_set_user_bpammo(id, CSW_USP, 120)
		give_item(id, "weapon_shield")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4usp + shield ^1.")
	
	}
	
	
	if(number == 17){
		
		give_item(id, "weapon_sg550")
		
		cs_set_user_bpammo(id, CSW_SG550, 120)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4sg550 ^1.")
	
	}
	
	
	if(number == 18){
		
		give_item(id, "weapon_scout")
		
		cs_set_user_bpammo(id, CSW_SCOUT, 90)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4scout ^1.")
	
	}
	
	
	if(number == 19){
		
		give_item(id, "weapon_mp5navy")
		
		cs_set_user_bpammo(id, CSW_MP5NAVY, 150)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4mp5 navy ^1.")
	
	}
	
	
	if(number == 20){
		
		give_item(id, "weapon_tmp")
		
		cs_set_user_bpammo(id, CSW_TMP, 200)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4tmp ^1.")
	
	}
	
	
	if(number == 21){
		
		give_item(id, "weapon_ump45")
		
		cs_set_user_bpammo(id, CSW_UMP45, 120)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4ump45 ^1.")
	
	}
	
	
	if(number == 22){
		
		give_item(id, "weapon_mac10")
		
		cs_set_user_bpammo(id, CSW_MAC10, 200)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4mac10 ^1.")
	
	}
	
	
	if(number == 23){
		
		give_item(id, "weapon_m249")
		
		cs_set_user_bpammo(id, CSW_M249, 250)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4m249 ^1.")
	
	}
	
	if(number == 24){
		
		give_item(id, "weapon_g3sg1")
		
		cs_set_user_bpammo(id, CSW_G3SG1, 100)
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4g3sg1 ^1.")
	
	}
	
	
	if(number == 25){
		
		give_item(id, "weapon_ak47")
		
		cs_set_user_bpammo(id, CSW_AK47, 90)
		give_item(id, "weapon_hegrenade")
		give_item(id, "weapon_smokegrenade")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_flashbang")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got ak47.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4ak47 + flash bang + he grenade + smoke grenade ^1.")
		
	}
	
	if(number == 26){
		
		give_item(id, "weapon_m4a1")
		
		cs_set_user_bpammo(id, CSW_M4A1, 90)
		give_item(id, "weapon_hegrenade")
		give_item(id, "weapon_smokegrenade")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_flashbang")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got ak47.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4m4a1 + flash bang + he grenade + smoke grenade ^1.")
		
	}
	
	
	if(number == 27){
		
		give_item(id, "weapon_aug")
		
		cs_set_user_bpammo(id, CSW_AUG, 90)
		give_item(id, "weapon_hegrenade")
		give_item(id, "weapon_smokegrenade")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_flashbang")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got ak47.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4aug + flash bang + he grenade + smoke grenade ^1.")
		
	}
	
	
	if(number == 28){
		
		give_item(id, "weapon_sg552")
		
		cs_set_user_bpammo(id, CSW_SG552, 90)
		give_item(id, "weapon_hegrenade")
		give_item(id, "weapon_smokegrenade")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_flashbang")
		
		give_item(id, "item_assaultsuit");
		give_item(id, "item_thighpack")
		
		// client_print(id, print_chat, "[Auto Weapon]: You got ak47.")
		ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1You got ^4sg552 + flash bang + he grenade + smoke grenade ^1.")
		
	}
	
	
	// =============== End ===============
	
	// client_print(id, print_chat, "[Auto Weapon]: Have fun with is weapon.")
	
	ColorChat(id, TEAM_COLOR, "^4[Auto Weapon]: ^1Have fun with is weapon.")
	
	return PLUGIN_HANDLED
	
}
--------- Links ---------

Source code link:

MG_Auto_Weapon.sma

Plugin Link:

MG_Auto_Weapon.amxx

--------- End ---------

Have fun boy
Mohamed Gaber is offline
Reply


Thread Tools
Display Modes

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 21:24.


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