Raised This Month: $ Target: $400
 0% 

Tuning off public method on menu select


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 03-11-2010 , 05:51   Tuning off public method on menu select
Reply With Quote #1

Why the hell this script is working wrong ? when i choose bullet damage mode. it shows damage done, but i can't turn it off anymore after 1 us

The actual problem is that the Bullet Mode won't turn off correctly. because when i turn it off, the "public on_damage" won't check player again, it checks only on plugin load ;(

PHP Code:
#include <amxmodx>

 
new bool:BulletMode[33] = false;
 new 
bool:VampireMode[33] = false;

 public 
plugin_init()
 {
    
register_plugin("TEST""1.0""Addinol");
    
    
register_event("Damage""on_damage""b""2!0""3=0""4!0")

    
g_MsgSync CreateHudSyncObj()

#if defined DAMAGE_RECIEVED
    
g_MsgSync2 CreateHudSyncObj()
#endif
 
}


 public 
Menu(id)
 {

    new 
menu menu_create("\rPLAYER Menu:""menu_handler");


    
//Now lets add some things to select from the menu
    
menu_additem(menu"\wBullet Mode""1"0);
    
menu_additem(menu"\wVampire Mode""1"0);


    
menu_setprop(menuMPROP_EXITMEXIT_ALL);


    
menu_display(idmenu0);
 }
 public 
menu_handler(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);

        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;

    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
      
BulletMode[id] = true;
      
VampireMode[id] = false;
          
client_print(idprint_chat"Bullet Damage activated");
          
menu_destroy(menu);
          return 
PLUGIN_HANDLED;
        }
        case 
2:
        {
      
BulletMode[id] = false;
      
VampireMode[id] = true;
          
client_print(idprint_chat"Vampire Mode activated");
          
menu_destroy(menu);
          return 
PLUGIN_HANDLED;
        }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 }

public 
on_damage(id)
{
    new 
attacker get_user_attacker(id)

#if defined DAMAGE_RECIEVED

    
if ( is_user_connected(id) && is_user_connected(attacker) )
    if (
get_user_flags(attacker) & ADMIN_LEVEL_H && BulletMode[id] == true)
    {
        new 
damage read_data(2)

        
set_hudmessage(255000.450.5020.14.00.10.1, -1)
        
ShowSyncHudMsg(idg_MsgSync2"%i^n"damage)
#else
    
if ( BulletMode[id] == true && get_user_flags(attacker) & ADMIN_LEVEL_H )
    {
        new 
damage read_data(2)
#endif
        
set_hudmessage(0100200, -1.00.5520.14.00.020.02, -1)
        
ShowSyncHudMsg(attackerg_MsgSync"%i^n"damage)
    }else{
    return 
PLUGIN_HANDLED;
}
    return 
PLUGIN_HANDLED;

reinert is offline
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 03-11-2010 , 06:37   Re: Tuning off public method on menu select
Reply With Quote #2

u dont need to destroy menu on every option
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-11-2010 , 07:06   Re: Tuning off public method on menu select
Reply With Quote #3

ok but the problem is when I use Bullet Mode, the Bullet Damage turn on, everything is good, but then on next round I want to use Vampire mode, but the Bullet Mode won't turn off, I Still can see damage done.
reinert is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-11-2010 , 09:28   Re: Tuning off public method on menu select
Reply With Quote #4

Then check it on every round start, or how often you want it.
Backstabnoob is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-11-2010 , 09:34   Re: Tuning off public method on menu select
Reply With Quote #5

Hmm it would be great if I could know how to do it
reinert is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-11-2010 , 12:46   Re: Tuning off public method on menu select
Reply With Quote #6

How do you call the menu?
Backstabnoob is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 03-11-2010 , 15:56   Re: Tuning off public method on menu select
Reply With Quote #7

PHP Code:
    register_clcmd("say /vipmenu","vipmenu"ADMIN_LEVEL_H

PHP Code:
public vipmenu(id) {    

   if(
get_user_flags(id) & ADMIN_LEVEL_H)
   {
    if (
playerUsedVipMenu[id] == true)
    {
        
client_print(idprint_chat"you can use vipmenu once per round");
        return 
PLUGIN_HANDLED;
    }
    
Menu(id);
    
playerUsedVipMenu[id] = true;
    return 
PLUGIN_HANDLED;
   }else{
       
client_print(idprint_chat"vipmenu only for vips");       
    }
   return 
PLUGIN_HANDLED;

reinert 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 08:36.


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