AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Help with a plugin (https://forums.alliedmods.net/showthread.php?t=302038)

FreezerPT 10-14-2017 11:09

Help with a plugin
 
Hello people, i want a plugin to block awp/auto in some maps! Like dust2x2, i know exists the awp/auto limit but i dont want them, because the awp/auto limit is for the number of players and i want a plugin to map!

brlight 10-14-2017 11:15

Re: Help with a plugin
 
Just enable plugin for certain maps

FreezerPT 10-14-2017 11:18

Re: Help with a plugin
 
Quote:

Originally Posted by brlight (Post 2554459)
Just enable plugin for certain maps

But bro i dont want to use that plugin! I want a plugin to block awp because the map is 2x2! Not because the players are like 7/10

DjSoftero 10-14-2017 11:31

Re: Help with a plugin
 
he just gave you the answer. and yet you say that you don`t want a plugin, because you want a plugin.

FreezerPT 10-14-2017 11:49

Re: Help with a plugin
 
Quote:

Originally Posted by DjSoftero (Post 2554465)
he just gave you the answer. and yet you say that you don`t want a plugin, because you want a plugin.


It's not that kind of plugin they suggested! This plugin blocks AWP / AUTO by the number of players and I want a block by being 2x2

WhiteFang1319 10-14-2017 12:15

Re: Help with a plugin
 
https://wiki.alliedmods.net/Configur...p_Config_Files

Add in the config:
PHP Code:

amx_restrict on awp 


DjSoftero 10-15-2017 02:16

Re: Help with a plugin
 
omg. just make the minimum of 33 players for awp and then enable by map. Was that so hard to figure out

EFFx 10-15-2017 11:36

Re: Help with a plugin
 
You must download cl_buy if you aren't using amxx 1.8.3 - https://forums.alliedmods.net/showthread.php?t=149380

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>

#if AMXX_VERSION_NUM < 183
#include <cl_buy>
#define MAX_PLAYERS 32
#else
#include <cstrike>
#endif

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

const TASK_CHECK 21021020

new const g_szMaps[] = 
{
    
"de_dust2x2"


new 
pCvarMinPlayers

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
pCvarMinPlayers register_cvar("ba_minplayers""10")
    
    if(
IsMap())
    {
        
RegisterHam(Ham_Spawn"player""playerSpawn"1)
    }
}

public 
playerSpawn(id)
{    
    if(
is_user_alive(id))
    {
        
set_task(1.0"check_AutoWeapon"id TASK_CHECK)
    }
}

#if AMXX_VERSION_NUM < 183
public client_buy(idiItem)
#else
public CS_OnBuy(idiItem)
#endif
{
    if(
iItem == CSW_AWP)
    {        
        if(!
isLessThanNeeded())
        {
            
ColorChat(id,"^4[AWPBlock] ^3AWP^x01 is disabled. You can buy whether server has^x04 %d^x01 players."get_pcvar_num(pCvarMinPlayers))  
            return 
PLUGIN_HANDLED
        
}
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
check_AutoWeapon(id)
{
    if(
isLessThanNeeded())
        return
        
    if(
IsMap())
        return
        
    
id -= TASK_CHECK

    
if(user_has_weapon(idCSW_AWP))
    {        
        
remove_weapon(id"weapon_awp")
        
ColorChat(id,"^4[AWPBlock] ^3AWP^x01 is disabled. You can buy whether server has^x04 %d^x01 players."get_pcvar_num(pCvarMinPlayers))  
    }
}

remove_weapon(idweapon[])
{
    if(!
equal(weapon"weapon_"7)) 
        return 
0
    
    
new wId get_weaponid(weapon)
     if(!
wId
        return 
0
    
    
new wEnt
    
while((wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname"weapon)) && pev(wEntpev_owner) != id) {}
    if(!
wEnt
        return 
0
    
    ExecuteHamB
(Ham_Weapon_RetireWeaponwEnt)
    
    if(!
ExecuteHamB(Ham_RemovePlayerItemidwEnt)) 
        return 
0

    ExecuteHamB
(Ham_Item_KillwEnt)
    
    
set_pev(idpev_weaponspev(id,pev_weapons) & ~(1<<wId))
    return 
1
}

bool:IsMap()
{
    new 
szMap[32]
    
get_mapname(szMap,charsmax(szMap))
    for(new 
isizeof g_szMapsi++)
    {
        if(
equal(szMapg_szMaps[i]))
        { 
            return 
true
        
}
    }
    return 
false
}

bool:isLessThanNeeded()
{
    new 
iTNumiPlayersT[MAX_PLAYERS], iCTNumiPlayersCT[MAX_PLAYERS]
    
    
get_players(iPlayersTiTNum"e""TERRORIST")
    
get_players(iPlayersCTiCTNum"e""CT")
        
    return (
iTNum iCTNum) >= get_pcvar_num(pCvarMinPlayers) ? true false
}

ColorChat(const id, const input[], any:...)
{
        new 
count 1players[32]
        static 
msg[191]
        
vformat(msg190input3)

        
replace_all(msg190"!g""^4"// verde
        
replace_all(msg190"!y""^1"// Default
        
replace_all(msg190"!t""^3"// Team

        
if (idplayers[0] = id; else get_players(playerscount"ch")
        {
                for (new 
0counti++)
                {
                        if (
is_user_connected(players[i]))
                        {
                                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                                
write_byte(players[i]);
                                
write_string(msg);
                                
message_end();
                        }
                }
        }


I did not test.


All times are GMT -4. The time now is 06:31.

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