AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   retrict buying weapons in 35hp_2 map. (https://forums.alliedmods.net/showthread.php?t=87207)

Metanabol 03-08-2009 07:44

retrict buying weapons in 35hp_2 map.
 
Hello, i made little script to fix bug then 35hp_2 or most_wanted map starts, there player can buy weapon in first round (then server starts)
but i get error then i try this to complile
PHP Code:

#include <amxmodx>
 #include <amxmisc>
 #include <cstrike>
 
new g_round 0
 
new bool:g_check false;
 new 
g_bug[][] =
 {
         
"35hp",
         
"ka_",
         
"most_"
 
}
 public 
plugin_init()
 {
     
register_plugin("MAP bug fix","1.0","Metanabol")
     
register_clcmd("p228","HandleCmd")
     
register_clcmd("hegrenade","HandleCmd")    
     
register_clcmd("smokegrenade","HandleCmd")
     
register_clcmd("elite","HandleCmd")
     
register_clcmd("fiveseven","HandleCmd")
     
register_clcmd("usp","HandleCmd")
     
register_clcmd("glock18","HandleCmd")
     
register_clcmd("deagle","HandleCmd")
     
register_logevent("logevent_Round_Start"2"1=Round_Start");
     new 
MapName[64];
 
         
get_mapname(MapName63);
  
         for (new 
Map 0Map sizeof(g_bug); Map++)
                 if (
containi(MapNameg_bug[Map]) != -1)
         {
             
g_check true;
     }
 }
 public 
logevent_Round_Start()
 {
     
g_round++
 }
 public 
HandleCmd(id){
     if(
g_round && g_check) {
              
client_print(0print_chat"[KPZ] Player tried to buy weapon.")
               return 
PLUGIN_HANDLED
    
}
 } 


hleV 03-08-2009 08:17

Re: retrict buying weapons in 35hp_2 map.
 
Code:
#include <amxmodx> #include <hamsandwich> #include <cstrike>   new g_MapNames[][] = {         "35hp"         "ka_",         "most_" };   public plugin_init() {         new MapName[32];         get_mapname(MapName, 31);           for (new Map = 0; Map < sizeof(g_MapNames); Map++)                 if (containi(MapName, g_MapNames[Map]) != -1)                 {                         RegisterHam(Ham_Spawn, "player", "Spawn_Player_Post", 1);                           break;                 } }   public Spawn_Player_Post(Client)         if (is_user_alive(Client))                 cs_set_user_money(Client, 0, 0);

Starsailor 03-08-2009 12:33

Re: retrict buying weapons in 35hp_2 map.
 
test this

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Remove Buy"
#define VERSION "1.0"
#define AUTHOR "Starsailor"

new const buyweapons[][] = {
    
    
"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""fiveseven""12gauge""autoshotgun",
    
"mp""c90""cv47""defender""clarion""krieg552",
    
"bullpup""magnum""d3au1""krieg550"
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_command(id){
    new 
Mapname[64]
    
    
get_mapname(Mapname63)
    new 
arg[13];
    
read_argv(0arg12
    
    if(
equali(Mapname,"35hp_2")) {
        for( new 
0sizeof(buyweapons); i++ )
        {
            if( 
equali(buyweapons[i], arg0) )
            {
                return 
PLUGIN_HANDLED
            
}
        }
        
    }
    
    
    return 
PLUGIN_CONTINUE



[ --<-@ ] Black Rose 03-08-2009 13:17

Re: retrict buying weapons in 35hp_2 map.
 
Instead of checking map on every client_command it would be a LOT better if you checked it once and set a variable or even better paused the plugin totally.

Code:
#include <amxmodx>   #define PLUGIN "Remove Buy" #define VERSION "1.0" #define AUTHOR "Supremacy"   new const buyweapons[][] = {  "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", "fiveseven", "12gauge", "autoshotgun",  "mp", "c90", "cv47", "defender", "clarion", "krieg552",  "bullpup", "magnum", "d3au1", "krieg550" }   public plugin_init() {    register_plugin(PLUGIN, VERSION, AUTHOR);    new mapname[64];  get_mapname(mapname, 63);    if ( ! equali(mapname, "35hp_2") )   pause("a"); }   public client_command(id) {    new arg[13];  read_argv(0, arg, 12);    for( new i = 0; i < sizeof(buyweapons); i++ ) {   if( equali(buyweapons[i], arg, 0) ) // 0? That's idiotic.    return PLUGIN_HANDLED;  }    return PLUGIN_CONTINUE; }


EDIT... Ripper? Seriously, your code sucked, i fixed it. Don't be a baby about it.
The great thing about Pawn is I can do whatever I want to your code.

ConnorMcLeod 03-08-2009 13:26

Re: retrict buying weapons in 35hp_2 map.
 
Just put sv_restart 1 in amxx.cfg and nobody will be able to buy.

Metanabol 03-08-2009 15:27

Re: retrict buying weapons in 35hp_2 map.
 
Very thanks everyone. I see a lot of ways to choose... i prefer hleV's choise, because it's very simple and usable :)

[ --<-@ ] Black Rose 03-08-2009 15:29

Re: retrict buying weapons in 35hp_2 map.
 
Quote:

Originally Posted by Metanabol (Post 776664)
Very thanks everyone. I see a lot of ways to choose... i prefer hleV's choise, because it's very simple and usable :)

BUZZ! Wrong. The easiest would be Connors and then mine.


All times are GMT -4. The time now is 08:59.

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