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

Pistol Only after 20 Rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 06-04-2023 , 14:11   Pistol Only after 20 Rounds
Reply With Quote #1

Hello. i would be happy when anyone get time and could do this great job for me. I want only that every 20 Rounds the next Round Only PISTOL round ist. When possible that each player gets a random pistol. All others (bombs etc, guns etc) would have to be blocked.

I hope for help. Thank you <3

for 1.9.
Godofwar is offline
quil
Junior Member
Join Date: Dec 2023
Old 01-01-2024 , 19:43   Re: Pistol Only after 20 Rounds
Reply With Quote #2

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size: 244 bytes
Code size: 1528 bytes
Data size: 1660 bytes
Stack/heap size: 16384 bytes; estimated max. usage=39 cells (156 bytes)
Total requirements: 19816 bytes
Done.

Try thist
Attached Files
File Type: sma Get Plugin or Get Source (LWAR_20.sma - 25 views - 1.6 KB)
quil is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-01-2024 , 22:02   Re: Pistol Only after 20 Rounds
Reply With Quote #3

Quote:
Originally Posted by quil View Post
Try thist
to block the other weapons you must apply CurWeapon with a bool where only secondary weapons are allowed
__________________
mlibre is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 01-02-2024 , 10:18   Re: Pistol Only after 20 Rounds
Reply With Quote #4

Quote:
Originally Posted by Godofwar View Post
Hello. i would be happy when anyone get time and could do this great job for me. I want only that every 20 Rounds the next Round Only PISTOL round ist. When possible that each player gets a random pistol. All others (bombs etc, guns etc) would have to be blocked.

I hope for help. Thank you <3

for 1.9.


Try

PHP Code:
#include <amxmodx>
#include <engine>
#include <fun>
#include <cstrike>
#include <hamsandwich>

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

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

new 
RoundCount 0;
new 
EnabledCvar;
new 
bool:IsPistolRound false;

public 
plugin_init() {
register_plugin("Pistol Round""1.0""Uzviseni Bog");
EnabledCvar register_cvar("amx_enable_pistolround""1");
register_logevent("OnRoundStart"2"1=Round_Start");
register_clcmd("buy""BlockBuyCommand");
register_clcmd("cl_autobuy""BlockBuyCommand");
register_clcmd("cl_rebuy""BlockBuyCommand");
register_clcmd("cl_setautobuy""BlockBuyCommand");
register_clcmd("cl_setrebuy""BlockBuyCommand");

register_clcmd("glock""BlockBuyCommand");
register_clcmd("usp""BlockBuyCommand");
register_clcmd("p228""BlockBuyCommand");
register_clcmd("deagle""BlockBuyCommand");
register_clcmd("elites""BlockBuyCommand");
register_clcmd("fn57""BlockBuyCommand");

register_clcmd("mp5""BlockBuyCommand");
register_clcmd("smg""BlockBuyCommand");
register_clcmd("mac10""BlockBuyCommand");
register_clcmd("tmp""BlockBuyCommand");
register_clcmd("ump45""BlockBuyCommand");
register_clcmd("p90""BlockBuyCommand");

register_clcmd("m3""BlockBuyCommand");
register_clcmd("xm1014""BlockBuyCommand");

register_clcmd("famas""BlockBuyCommand");
register_clcmd("m4a1""BlockBuyCommand");
register_clcmd("ak47""BlockBuyCommand");
register_clcmd("sg552""BlockBuyCommand");
register_clcmd("galil""BlockBuyCommand");
register_clcmd("aug""BlockBuyCommand");

register_clcmd("scout""BlockBuyCommand");
register_clcmd("awp""BlockBuyCommand");
register_clcmd("sg550""BlockBuyCommand");
register_clcmd("g3sg1""BlockBuyCommand");

register_clcmd("m249""BlockBuyCommand");

register_clcmd("hegren""BlockBuyCommand");
register_clcmd("flash""BlockBuyCommand");
register_clcmd("sgren""BlockBuyCommand");
register_clcmd("vest""BlockBuyCommand");
register_clcmd("vesthelm""BlockBuyCommand");
register_clcmd("shield""BlockBuyCommand");
register_clcmd("buyammo1""BlockBuyCommand");
register_clcmd("buyammo1""BlockBuyCommand");
register_clcmd("buyequip""BlockBuyCommand");

}

public 
OnRoundStart() {
    if (
get_pcvar_num(EnabledCvar)) {
        
RoundCount++;
        
IsPistolRound = (RoundCount == 0);
        if (
IsPistolRound) {
            
SetPistolRound();
        }
    }
}

public 
BlockBuyCommand(id) {
    if (
IsPistolRound) {
        
client_print(idprint_chat"Buy is off");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

SetPistolRound() {
    for (new 
1<= get_maxplayers(); i++) {
        if (
is_user_connected(i)) {
            
strip_user_weapons(i);
            new 
randomPistol random_num(0sizeof(g_szSecondary) - 1);
            
give_item(ig_szSecondary[randomPistol][_WeaponName]);
            
cs_set_user_bpammo(ig_szSecondary[randomPistol][_CSW], g_szSecondary[randomPistol][_Ammo]);
        }
    }
    
client_print(0print_chat"Pistol Round Started");

Uzviseni Bog is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-03-2024 , 06:25   Re: Pistol Only after 20 Rounds
Reply With Quote #5

Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>

#define REQUIRED_ROUNDS 20

new g_iRoundCount

public plugin_init()
{
	register_plugin("X Rounds Random Pistol", "0.0.1", "Jhob94")
	
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
	register_event("TextMsg", "Event_Restart", "a", "2&#Game_C", "2&#Game_w")
	
	RegisterHam(Ham_AddPlayerItem, "player", "Ham_AddPlayerItem_Pre")
	RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
}

public Event_NewRound()
{
	if(g_iRoundCount < REQUIRED_ROUNDS)
		g_iRoundCount++
	
	else
		g_iRoundCount = 1
}

public Event_Restart()
{
	g_iRoundCount = 0
}

public Ham_Spawn_Post(id)
{
	if(g_iRoundCount == REQUIRED_ROUNDS && is_user_alive(id))
	{
		strip_user_weapons(id)
		new iRandomWeapon = random_num(1, 6)
		
		switch(iRandomWeapon)
		{
			case 1:
			{
				give_item(id, "weapon_glock18")
				cs_set_user_bpammo(id, CSW_GLOCK18, 90)
			}
			case 2:
			{
				give_item(id, "weapon_usp")
				cs_set_user_bpammo(id, CSW_USP, 90)
			}
			case 3:
			{
				give_item(id, "weapon_p228")
				cs_set_user_bpammo(id, CSW_P228, 90)
			}
			case 4:
			{
				give_item(id, "weapon_elite")
				cs_set_user_bpammo(id, CSW_ELITE, 90)
			}
			case 5:
			{
				give_item(id, "weapon_fiveseven")
				cs_set_user_bpammo(id, CSW_FIVESEVEN, 90)
			}
			case 6:
			{
				give_item(id, "weapon_deagle")
				cs_set_user_bpammo(id, CSW_DEAGLE, 90)
			}
		}
	}
}

public Ham_AddPlayerItem_Pre(id , iWeapon)
{
	if(g_iRoundCount == REQUIRED_ROUNDS && is_user_alive(id))
	{
		new iCSW = cs_get_weapon_id(iWeapon)
		if(iCSW != CSW_GLOCK18 && iCSW != CSW_USP && iCSW != CSW_P228 && iCSW != CSW_ELITE && iCSW != CSW_FIVESEVEN && iCSW != CSW_DEAGLE)
		{
			set_pev(iWeapon, pev_flags, pev(iWeapon, pev_flags) | FL_KILLME)
			SetHamReturnInteger(0)
			return HAM_SUPERCEDE
		}
	}
	
	return HAM_IGNORED
}
__________________
Jhob94 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-05-2024 , 09:26   Re: Pistol Only after 20 Rounds
Reply With Quote #6

good method, "Ham_AddPlayerItem" I overlooked it
__________________
mlibre 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 01:46.


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