AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   1st round no menu (https://forums.alliedmods.net/showthread.php?t=140036)

zirualas 10-08-2010 10:42

1st round no menu
 
How i Can do that my menu not pop up on first round, it's pop up only on 2nd round.

reinert 10-08-2010 11:27

Re: 1st round no menu
 
create variable: round... then hook event round start, and check if(round > 1) then show menu else don't.

zirualas 10-08-2010 11:35

Re: 1st round no menu
 
Ok I trying to do something but i having error.
Code:
PHP Code:

#include <amxmodx> 
#include <amxconst>
#include <cstrike>
#include <fun> 
#include <hamsandwich> 
#include <colorchat>

#define AUTHOR <zirual>
#define VERSION <1.0>
#define PLUGIN <Vip menu>
 

public plugin_init()
{
    
register_plugin("Vipmenu","1.0","Zirual");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
RegisterHam(Ham_Spawn"player""runda"1)
    
register_logevent("event_new_round"2"1=Round_Start"
}
public 
runda(id)
{
    
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha255); 
}
public 
fwHamPlayerSpawnPost(id
{
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        new 
menu menu_create("\gVipmenu:""menu_handler"); 
     
        
menu_additem(menu"\r +2500\w Dollars""1"0);
        
menu_additem(menu"\w Granades""2"0);
        
menu_additem(menu"\w Low Gravity""3"0);
        
menu_additem(menu"\w Tactical Shield""4"0);
        
menu_additem(menu"\w 75% Visibility""5"0);
     
        
menu_setprop(menuMPROP_EXITMEXIT_ALL
        
menu_display(idmenu0);
    }
    else
    {
    
ColorChat(idGREEN"^x03[V.I.P]^x01Wanna VIP? Say /vip")
    } 


public 
menu_handler(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
     
    new 
data[6], iName[64]; 
    new 
acesscallback
     
    
menu_item_getinfo(menuitemacessdata,6iName63callback); 
    new 
key str_to_num(data); 
     
    switch(
key
    { 
        case 
:
        {
        
cs_set_user_money(id cs_get_user_money(id) + 25000)
    }
        case 

        {
        
give_item(id"weapon_smokegrenade")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_hegrenade")
        } 
        case 

        {  
        
set_user_gravity(id0.7)
    }
        case 

    {
        
give_item(id"weapon_shield")
    }
    case 
:
    {
        
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha191);
    } 
    }

    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED;
}


public 
event_new_round() 

Error:
PHP Code:

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// vipmenu[pb].sma
// G:\Program Files\Valve\cstrike\addons\amxmodx\scripting\vipmenu[pb].sma(91) :
 
error 036: empty statement
//
// 1 Error.
// Could not locate output file G:\Program Files\Valve\cstrike\addons\amxmodx\sc
ripting\compiled\vipmenu[pb].amx (compile failed).
//
// Compilation Time: 0,17 sec
// ----------------------------------------

Press enter to exit ... 


naven 10-08-2010 12:20

Re: 1st round no menu
 
Quote:

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
RegisterHam(Ham_Spawn, "player", "runda", 1)
Why do you define same thing twice?

And:
Code:
#include <amxmodx> #include <amxmisc> new bool:firstround = true; public plugin_init(){     register_plugin("plugin","1.0","naven")     register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0")     } public Nowa_Runda() {     if(firstround)     {     //do something(first round)     firstround = false; //set to false so it won't happen anymore     }else     {         //other rounds     }     }

zirualas 10-08-2010 14:34

Re: 1st round no menu
 
I don't understand ;[

fysiks 10-08-2010 15:31

Re: 1st round no menu
 
Do they only spawn once per round? Do you want the menu to open on spawn or on new round?

zirualas 10-09-2010 02:53

Re: 1st round no menu
 
I want what menu pop up only on round start and menu show up only on 2nd round

Xalus 10-09-2010 06:58

Re: 1st round no menu
 
Try this.

PHP Code:

#include <amxmodx> 
#include <amxconst>
#include <cstrike>
#include <fun> 
#include <hamsandwich> 
#include <colorchat>

new Rounds;

public 
plugin_init()
{
    
register_plugin("Vipmenu","1.0","Zirual");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
RegisterHam(Ham_Spawn"player""runda"1)
    
register_logevent("event_new_round"2"1=Round_Start"
}
public 
runda(id) {
    
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha255); 
}
public 
fwHamPlayerSpawnPost(id)  {
    if(
get_user_flags(id) & ADMIN_LEVEL_H && Rounds 1) {
        new 
menu menu_create("\gVipmenu:""menu_handler"); 
        
        
menu_additem(menu"\r +2500\w Dollars""1"0);
        
menu_additem(menu"\w Granades""2"0);
        
menu_additem(menu"\w Low Gravity""3"0);
        
menu_additem(menu"\w Tactical Shield""4"0);
        
menu_additem(menu"\w 75% Visibility""5"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL
        
menu_display(idmenu0);
    } else {
        
ColorChat(idGREEN"^x03[V.I.P]^x01Wanna VIP? Say /vip")
    } 


public 
menu_handler(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
    
    new 
data[6], iName[64]; 
    new 
acesscallback
    
    
menu_item_getinfo(menuitemacessdata,6iName63callback); 
    new 
key str_to_num(data); 
    
    switch(
key
    { 
        case 
:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 25000)
        }
        case 

        {
            
give_item(id"weapon_smokegrenade")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_hegrenade")
        } 
        case 

        {  
            
set_user_gravity(id0.7)
        }
        case 

        {
            
give_item(id"weapon_shield")
        }
        case 
:
        {
            
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha191);
        } 
    }
    
    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED;
}


public 
event_new_round()
    
Rounds++; 


hornet 10-09-2010 07:00

Re: 1st round no menu
 
Try this:
PHP Code:

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

#define AUTHOR <zirual>
#define VERSION <1.0>
#define PLUGIN <Vip menu>
 
new g_Round;

public 
plugin_init()
{
    
register_plugin("Vipmenu","1.0","Zirual");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
register_event("HLTV","evRoundStart","a","1=0","2=0");
}

public 
evRoundStart()
{
    
g_Round += 1;
}

public 
fwHamPlayerSpawnPost(id
{
    
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha255);
    
    if( 
g_Round != )
    return 
PLUGIN_HANDLED;
    
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        new 
menu menu_create("\gVipmenu:""menu_handler"); 
     
        
menu_additem(menu"\r +2500\w Dollars""1"0);
        
menu_additem(menu"\w Granades""2"0);
        
menu_additem(menu"\w Low Gravity""3"0);
        
menu_additem(menu"\w Tactical Shield""4"0);
        
menu_additem(menu"\w 75% Visibility""5"0);
     
        
menu_setprop(menuMPROP_EXITMEXIT_ALL
        
menu_display(idmenu0);
    }
    else
    {
        
ColorChat(idGREEN"^x03[V.I.P]^x01Wanna VIP? Say /vip")
    } 


public 
menu_handler(idmenuitem

    if( 
item == MENU_EXIT 
    { 
        
menu_destroy(menu); 
        return 
PLUGIN_HANDLED
    } 
     
    new 
data[6], iName[64]; 
    new 
acesscallback
     
    
menu_item_getinfo(menuitemacessdata,6iName63callback); 
    new 
key str_to_num(data); 
     
    switch(
key
    { 
        case 
:
        {
            
cs_set_user_money(id cs_get_user_money(id) + 25000)
        }
        case 

        {
            
give_item(id"weapon_smokegrenade")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_flashbang")
            
give_item(id"weapon_hegrenade")
        } 
        case 

        {  
            
set_user_gravity(id0.7)
        }
        case 

        {
            
give_item(id"weapon_shield")
        }
        case 
:
        {
            
set_user_rendering(idkRenderFxNone255255255kRenderTransAlpha191);
        } 
    }

    
menu_destroy(menu); 
    return 
PLUGIN_HANDLED;


EDIT: So do you actually only want the menu to come up on the second round or the second round and every round after?

zirualas 10-09-2010 07:14

Re: 1st round no menu
 
Working, thx very much ;]


All times are GMT -4. The time now is 10:23.

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