AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Special Round -Knife Round (https://forums.alliedmods.net/showthread.php?t=318514)

Alber9091 09-04-2019 15:02

Special Round -Knife Round
 
I want plugin that after every x number rounds there should be special round- Knife Only Round.

For Example:
At 15 rounds, HUD Shows- Special Round- Knife Only & there should be only Knife Round.
Then again at 30 rounds, Special Round- Knife Only.

And it continues till map ends. [well my mp_maxrounds is 150].

Thanks

DON KHAN 1 09-06-2019 02:51

Re: Special Round -Knife Round
 
search?!
PHP Code:

//* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine> 
#include <fun>
#include <cstrike>
#include <hamsandwich>

/* credits:
Flicker For Random Pistols
v3x For amxx menu generator
Arkshine For disable buy
zmd94 For Give me The Code by Arkshine
*/

enum _:g_eWeaponData
{
_NameForChat[32],
_WeaponName[32],
_Ammo,
_CSW
}

enum _:g_eWeaponTypes
{
S
}

new const 
g_szSecondary[][g_eWeaponData]=
{
{
"Glock18",     "weapon_glock18",     240,     CSW_GLOCK18},
{
"Usp",     "weapon_usp",        240,     CSW_USP},
{
"P228",     "weapon_p228",        240,     CSW_P228},
{
"Dual Elites""weapon_elite",     240,     CSW_ELITE},
{
"Fiveseven",     "weapon_fiveseven",    240,     CSW_FIVESEVEN},
{
"Deagle",     "weapon_deagle",     240,     CSW_DEAGLE}
}

new 
g_WpnID[g_eWeaponTypes]
new 
EnabledCvar

public plugin_init() {
register_plugin("Special Round""Version""Constentine")
register_clcmd("amx_sprmenu""SprMenuShow")
register_clcmd("say /spr""SprMenuShow")

EnabledCvar register_cvar("amx_enable""1")// Enable/Disable Plugin
}

public 
SprMenuShow(id)
{
if(
get_pcvar_numEnabledCvar ) && get_user_flags(id) & ADMIN_ALL)
{
new 
menu menu_create("Special Round""SprMenuHandler"
menu_additem(menu"Knife round""1"0
menu_additem(menu"grenade+knife round""2"0
menu_additem(menu"shotgun round""3"0
menu_additem(menu"deagle round""4"0
menu_additem(menu"awp round""5"0
menu_additem(menu"random pistul round""6"0
menu_additem(menu"m4a1 round""7"0
menu_additem(menu"ak-47 round""8"0
menu_additem(menu"tmp round""9"0
menu_additem(menu"Unlimated Grenades round""10"0
menu_setprop(menuMPROP_EXITMEXIT_ALL

menu_display(idmenu0
}
}

public 
SprMenuHandler(idmenuitem)
{
if( 
item == MENU_EXIT )
{
menu_destroy(menu);
return 
PLUGIN_HANDLED;
}
new 
data[6], szName[33]; 
new 
accescallback;
menu_item_getinfo(menuitemaccesdata,charsmax(data), szName,charsmax(szName), callback
new 
key str_to_num(data); 
switch(
key
{
case 
1: { 
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_knife")
client_print(0print_chat"Admin Choose Knife Round!")
}
case 
2: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_knife")
give_item(id"weapon_hegrenade")
give_item(id"weapon_flashbang")
give_item(id"weapon_flashbang")
give_item(id"weapon_smokegrenade")  
client_print(0print_chat"Admin Choose Grenades And Knife Round!")
}
case 
3: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_m3")
give_item(id"weapon_xm1014")
cs_set_user_bpammo(id,CSW_M3,240)  
cs_set_user_bpammo(id,CSW_XM1014,240
client_print(0print_chat"Admin Choose Shotgun Round!"
}
case 
4: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_deagle")
cs_set_user_bpammo(id,CSW_DEAGLE,240)  
client_print(0print_chat"Admin Choose Deagle Round!")
}
case 
5: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_awp")
cs_set_user_bpammo(id,CSW_AWP,240)  
client_print(0print_chat"Admin Choose Awp Round!")
}
case 
6: {
hideBuyIcon
strip_user_weapons
(id
g_WpnID[S] = random_num(1charsmax(g_szSecondary))
give_item(idg_szSecondary[g_WpnID[S]][_WeaponName])
cs_set_user_bpammo(idg_szSecondary[g_WpnID[S]][_CSW], g_szSecondary[g_WpnID[S]][_Ammo])
client_print(0print_chat"Admin Choose Random Pistols Round!")
}
case 
7: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_m4a1")
cs_set_user_bpammo(id,CSW_M4A1,240)
client_print(0print_chat"Admin Choose M4A1 Round!"
}
case 
8: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_ak47")
cs_set_user_bpammo(id,CSW_AK47,240
client_print(0print_chat"Admin Choose AK47 Round!")
}
case 
9: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_tmp")
cs_set_user_bpammo(id,CSW_TMP,240
client_print(0print_chat"Admin Choose Tmp Round!")
}
case 
10: {
hideBuyIcon
strip_user_weapons
(id
give_item(id"weapon_hegrenade")
give_item(id"weapon_flashbang")
give_item(id"weapon_flashbang")
give_item(id"weapon_smokegrenade")
cs_set_user_bpammo(id,CSW_HEGRENADE,240)  
cs_set_user_bpammo(id,CSW_FLASHBANG,240)  
cs_set_user_bpammo(id,CSW_SMOKEGRENADE,240)  
client_print(idprint_chat"Admin Choose Unlimated Grenades Round!")
}
}
menu_destroy(menu);
return 
PLUGIN_HANDLED;


hideBuyIcon()
{
new const 
szClassnameBuy[] = "func_buyzone"
remove_entity_name(szClassnameBuy)
new 
ent create_entity(szClassnameBuy)
entity_set_origin(entFloat:{8192.08192.08192.0})
entity_set_int(entEV_INT_solidSOLID_NOT)



Alber9091 09-06-2019 04:54

Re: Special Round -Knife Round
 
@DonKhan1, Its not automatic, /spr is command is to be used then you have multiple options. Its already searched then asked.

And better use [PHP] or [Pawn] in codes. It makes it, much easier to understand.

Still, Thank You !! Appreciated.

LearninG 09-06-2019 10:00

Re: Special Round -Knife Round
 
cvar :
Quote:

knife_round_delay "15"
main plugin :
Code:
/* Knife Round =========== Description After every X rounds , an special knife round will be occur. */ #include <amxmodx> #include <fun> #include <engine> new const HUD_COLOR[3] = {0 , 255 , 0} const Float: HUD_POSITION_X = -1.0 const Float: HUD_POSITION_Y = 0.25 const HOLD_TIME = 5 new const g_szBuyCmds[ ][ ] = {     "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47",     "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash", "hegren",     "sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge",     "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550",     "buyammo1", "buyammo2" } new const VERSION[] = "1.0" new const PLAYER_CLASS[] = "player" new g_knife_round new bool: g_is_knife_round new cvar_knife_round public plugin_init() {     register_plugin("Knife Round" , VERSION , "LearninG")     for (new i; i<sizeof g_szBuyCmds; i++)     {         register_clcmd(g_szBuyCmds[i] , "block_buy")     }     register_touch("armoury_entity", PLAYER_CLASS, "PlayerTouchArmoury")     register_touch("weaponbox", PLAYER_CLASS, "PlayerTouchWeaponBox")     register_touch("weapon_shield", PLAYER_CLASS, "PlayerTouchShield")     register_logevent("event_new_round",2,"0=World triggered","1=Round_Start")     register_cvar("knife_round_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY)     cvar_knife_round = register_cvar("knife_round_delay" , "15") } public event_new_round() {     g_is_knife_round = false     g_knife_round++     if (g_knife_round == get_pcvar_num(cvar_knife_round))     {         g_is_knife_round = true         g_knife_round = 0         new players[32], num         get_players(players, num, "ach")         for( --num; num >= 0; num-- )         {             strip_user_weapons(players[num])             give_item(players[num] , "weapon_knife")             set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X , HUD_POSITION_Y , 0, 8.0, 6.0, 0.3, 0.3, HOLD_TIME)             show_hudmessage(players[num] , "Knife Round!!!")         }     } } public block_buy() {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public PlayerTouchArmoury(ent, id) {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public PlayerTouchWeaponBox(ent, id) {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public PlayerTouchShield(ent, id) {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
let me know if any bug occurres.

Alber9091 09-06-2019 10:53

Re: Special Round -Knife Round
 
I have question !! Not only buy but you have to block pickup of weapons too, since guns lie on ground. You can use reapi, let me provide you a code, may it help you. (even you can use this code and bit modify it just by adding cvar that it work only at x number of rounds [with HUD annoucing]. Uncomment all weapons and Comment Knife).

P.S: By trying this method, we can set special round for any weapon

Part Of Your Code


Code:
#include <amxmodx> #include <reapi> // uncomment that you need to restrict these item's. new const ItemID:g_rRestrictWeapons[] = {     ITEM_SHIELDGUN,     // ITEM_P228,     // ITEM_GLOCK,     // ITEM_SCOUT,     // ITEM_HEGRENADE,     // ITEM_XM1014,     // ITEM_C4,     // ITEM_MAC10,     // ITEM_AUG,     // ITEM_SMOKEGRENADE,     // ITEM_ELITE,     // ITEM_FIVESEVEN,     // ITEM_UMP45,     ITEM_SG550,     // ITEM_GALIL,     // ITEM_FAMAS,     // ITEM_USP,     // ITEM_GLOCK18,     // ITEM_AWP,     // ITEM_MP5N,     // ITEM_M249,     // ITEM_M3,     // ITEM_M4A1,     // ITEM_TMP,     ITEM_G3SG1,     // ITEM_FLASHBANG,     // ITEM_DEAGLE,     // ITEM_SG552,     // ITEM_AK47,     // ITEM_KNIFE,     // ITEM_P90,     // don't touch it!!     ITEM_NONE }; new const ItemID:g_rRestrictItems[] = {     // ITEM_NVG,     // ITEM_DEFUSEKIT,     // ITEM_KEVLAR,     // ITEM_ASSAULT,     // ITEM_LONGJUMP,     // ITEM_HEALTHKIT,     // ITEM_ANTIDOTE,     // ITEM_SECURITY,     // ITEM_BATTERY,     // ITEM_SUIT,     // don't touch it!!     ITEM_NONE }; enum SectionBits {     SECTION_WEAPONS = 0,     SECTION_ITEMS }; new g_bitsRestrict[SectionBits] = {}; public plugin_init() {     register_plugin("Items Restrict", "1.1", "s1lent");     if (g_rRestrictWeapons[0] == ITEM_NONE && g_rRestrictItems[0] == ITEM_NONE) {         set_fail_state("Arrays g_rRestrictWeapons and g_rRestrictItems are empty!");         return;     }     new i;     for (i = 0; g_rRestrictWeapons != ITEM_NONE; i++)         g_bitsRestrict[SECTION_WEAPONS] |= (1 << any:g_rRestrictWeapons);     for (i = 0; g_rRestrictItems != ITEM_NONE; i++)         g_bitsRestrict[SECTION_ITEMS] |= (1 << any:(g_rRestrictItems % ITEM_NVG));     RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "CBasePlayer_HasRestrictItem"); } public CBasePlayer_HasRestrictItem(const id, const ItemID:item, const ItemRestType:type) {     if ((item < ITEM_NVG) ? g_bitsRestrict[SECTION_WEAPONS] & (1 << any:item) :             g_bitsRestrict[SECTION_ITEMS] & (1 << any:(item % ITEM_NVG)))     {         if (type == ITEM_TYPE_BUYING) {             client_print(id, print_center, "* This item is restricted *");         }         // return true, let's restrict up this item         SetHookChainReturn(ATYPE_BOOL, true);         return HC_SUPERCEDE;     }     return HC_CONTINUE; }

LearninG 09-06-2019 12:27

Re: Special Round -Knife Round
 
i think you didn't tested code , buy menu + weapon pick up was blocked.

Alber9091 09-06-2019 14:23

Re: Special Round -Knife Round
 
Quote:

Originally Posted by LearninG (Post 2666077)
i think you didn't tested code , buy menu + weapon pick up was blocked.

Sorry, yes I didn't tested. I will test it soon & will let you know.

Alber9091 09-06-2019 16:11

Re: Special Round -Knife Round
 
Plugin running but not working.
[ 7] Knife Round 1.0 LearninG knife_round running

No Error Logs.
Plugin Not Working nor any HUD at 15 rounds I even changed cvar to 10, still it didn't work.

Another thing, if anyone is having any weapon from last round, plugin blocks switch of weapon to another weapon in knife round e.g Primary, Secondary, Nades.

LearninG 09-06-2019 17:14

Re: Special Round -Knife Round
 
tested in offline & hlds server, works fine !
Quote:

Originally Posted by Alber9091 (Post 2666114)
Another thing, if anyone is having any weapon from last round, plugin blocks switch of weapon to another weapon in knife round e.g Primary, Secondary, Nades.

It was included.

updated something use this and let me know results :
Code:
/* Knife Round =========== Description After every X rounds , an special knife round will be occur. */ #include <amxmodx> #include <fun> #include <engine> // Red , Green , Blue new const HUD_COLOR[3] = {0 , 255 , 0} // Hud X position const Float: HUD_POSITION_X = -1.0 // Hud Y position const Float: HUD_POSITION_Y = 0.25 // Hud display time const HOLD_TIME = 5 // buy menu commands new const g_szBuyCmds[ ][ ] = {     "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47",     "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash", "hegren",     "sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge",     "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550",     "buyammo1", "buyammo2" } new const VERSION[] = "1.0" // players class (needed when we want to block weapon pick up) new const PLAYER_CLASS[] = "player" // variable to increase value new g_knife_round // is knife round ? new bool: g_is_knife_round // cvar new cvar_knife_round public plugin_init() {     register_plugin("Knife Round" , VERSION , "LearninG")     // looping through buy commands     for (new i; i<sizeof g_szBuyCmds; i++)     {         register_clcmd(g_szBuyCmds[i] , "block_buy")     }     // called when user touch weapons , shield ...     register_touch("armoury_entity", PLAYER_CLASS, "PlayerTouchArmoury")     register_touch("weaponbox", PLAYER_CLASS, "PlayerTouchWeaponBox")     register_touch("weapon_shield", PLAYER_CLASS, "PlayerTouchShield")     // event_new_round     register_logevent("event_new_round",2,"0=World triggered","1=Round_Start")     register_event( "30" , "event_intermission" , "a" )     register_cvar("knife_round_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY)     // store cvar in variable     cvar_knife_round = register_cvar("knife_round_delay" , "15") } // called when new round begins public event_new_round() {     g_is_knife_round = false     // increase variable value by 1     g_knife_round++     // variable value reached our cvar number ?     if (g_knife_round == get_pcvar_num(cvar_knife_round))     {         // Start round         g_is_knife_round = true         g_knife_round = 0         // looping through all connected players         new players[32], num         get_players(players, num, "a")         for( --num; num >= 0; num-- )         {             // take away players weapon             strip_user_weapons(players[num])             // give them a knife             give_item(players[num] , "weapon_knife")             // set our hud message and show it to them.             set_hudmessage(HUD_COLOR[0] , HUD_COLOR[1] , HUD_COLOR[2] , HUD_POSITION_X , HUD_POSITION_Y , 0, 8.0, 6.0, 0.3, 0.3, HOLD_TIME)             show_hudmessage(players[num] , "Knife Round!!!")         }     } } public block_buy() {     // is knife round ?     if (g_is_knife_round)     {         // block buy commands         return PLUGIN_HANDLED     }     // allow buy commands     return PLUGIN_CONTINUE } public PlayerTouchArmoury(ent, id) {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public PlayerTouchWeaponBox(ent, id) {     // player has touched a weapon , when round is knife_round     if (g_is_knife_round)     {         // block weapon pickup         return PLUGIN_HANDLED     }     // allow pick up     return PLUGIN_CONTINUE } // player has touched shield. public PlayerTouchShield(ent, id) {     if (g_is_knife_round)     {         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE } public event_intermission() {     g_is_knife_round = false     g_knife_round = 0 }
are you using reHlds ? (if yes , i'm not sure if it will work )

Alber9091 09-06-2019 17:36

Re: Special Round -Knife Round
 
Yes, I'm using ReHLDS, ReGame & AMXX 1.90 [5249] !!
Nope, Not working.


All times are GMT -4. The time now is 00:49.

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