Raised This Month: $32 Target: $400
 8% 

Special Round -Knife Round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-04-2019 , 15:02   Special Round -Knife Round
Reply With Quote #1

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
Alber9091 is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 09-06-2019 , 02:51   Re: Special Round -Knife Round
Reply With Quote #2

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)

__________________
Facebook
My YouTube
Ro{Y}aL WarLanD CommuniTy
Selling Zombie CSO 4.3 Money System Mod

Last edited by DON KHAN 1; 09-06-2019 at 08:11.
DON KHAN 1 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-06-2019 , 04:54   Re: Special Round -Knife Round
Reply With Quote #3

@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.

Last edited by Alber9091; 09-06-2019 at 04:55.
Alber9091 is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-06-2019 , 10:00   Re: Special Round -Knife Round
Reply With Quote #4

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.
LearninG is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-06-2019 , 10:53   Re: Special Round -Knife Round
Reply With Quote #5

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; }

Last edited by Alber9091; 09-06-2019 at 12:15.
Alber9091 is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-06-2019 , 12:27   Re: Special Round -Knife Round
Reply With Quote #6

i think you didn't tested code , buy menu + weapon pick up was blocked.

Last edited by LearninG; 09-06-2019 at 12:30.
LearninG is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-06-2019 , 14:23   Re: Special Round -Knife Round
Reply With Quote #7

Quote:
Originally Posted by LearninG View Post
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 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-06-2019 , 16:11   Re: Special Round -Knife Round
Reply With Quote #8

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.

Last edited by Alber9091; 09-06-2019 at 16:12.
Alber9091 is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-06-2019 , 17:14   Re: Special Round -Knife Round
Reply With Quote #9

tested in offline & hlds server, works fine !
Quote:
Originally Posted by Alber9091 View Post
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 )
LearninG is offline
Old 09-06-2019, 17:27
Alber9091
This message has been deleted by Alber9091. Reason: Nvm, please see next page.
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 09-06-2019 , 17:36   Re: Special Round -Knife Round
Reply With Quote #10

Yes, I'm using ReHLDS, ReGame & AMXX 1.90 [5249] !!
Nope, Not working.

Last edited by Alber9091; 09-06-2019 at 17:51.
Alber9091 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 04:51.


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