Raised This Month: $32 Target: $400
 8% 

Solved VIP Menu Plugin problems with compiling


Post New Thread Reply   
 
Thread Tools Display Modes
l00ka
Junior Member
Join Date: Sep 2012
Old 03-29-2020 , 09:43   Re: VIP Menu Plugin problems with compiling
Reply With Quote #11

With your code, now I get on each regular kill 60 HP back and on each Headshot kill 0 HP. So, its still not working .

Quote:
Originally Posted by Napoleon_be View Post
Try again, Let me know if it works or not.

PHP Code:
/* Plugin created by .l00ka*/

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

#define PLUGIN "VIP Menu by .l00ka"
#define VERSION "1.0"
#define AUTHOR ".l00ka"


new mVIPmenu// Menu
new mcbVIPMenu// Menu Callback
new VipUsed[33];
new const 
PREFIX[] = { "!g[VIP-MENU]!n" };
new 
nSelectedItem 0;
new 
pHeadShot;
new 
pKill;
new 
pMaxHp;
new 
checkReceiveBonusHP[33];


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("DeathMsg""add_bonus_hp""a""1>0");
    
RegisterHam(Ham_Spawn"player""FwdHamSpawn_Post"1);
    
    
register_clcmd("say vm""showVIPmenu"ADMIN_LEVEL_H);
    
register_clcmd("say /vm""showVIPmenu"ADMIN_LEVEL_H);
    
register_clcmd("say vipmenu""showVIPmenu"ADMIN_LEVEL_H);
    
register_clcmd("say /vipmenu""showVIPmenu"ADMIN_LEVEL_H);
    
    
// Features
    
pHeadShot register_cvar("vipmenu_hp_hs""30");
    
pKill register_cvar("vipmenu_hp""15");
    
pMaxHp register_cvar("vipmenu_max_hp""100");
}

public 
client_putinserver(id)
{
    
checkReceiveBonusHP[id] = false;
}

public 
FwdHamSpawn_Post(id)
{
    if (
is_user_alive(id)) 
    {
        
execOnNextRound(id);
        
// Restrict menu for one time per round
        
VipUsed[id] = false;
    }
}


public 
showVIPmenu(idlevel)
{
    if( !( 
get_user_flagsid ) & level ) )
    {
        
console_printid"You have no access to this command." );
        return 
PLUGIN_HANDLED;
    }
    if(!
VipUsed[id]) 
    {    
        
/* Menu Choose VIP Feature: */
        
mVIPmenu menu_create("\yChoose VIP Feature: ^n\rby .l00ka""mh_VipMenuHandler");
        
mcbVIPMenu menu_makecallback("mcb_VIPMenu")
        switch(
nSelectedItem) {
        
            case 
0
            {
                
menu_additem(mVIPmenu"Kevler + Helm""1"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"Grenade Pack""2"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"HP Bonus on Kill""3"ADMIN_LEVEL_H0);
            }
            
            case 
1
            {
                
menu_additem(mVIPmenu"Kevler + Helm \r*""1"ADMIN_LEVEL_HmcbVIPMenu);
                
menu_additem(mVIPmenu"Grenade Pack""2"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"HP Bonus on Kill""3"ADMIN_LEVEL_H0);
            }
            case 
2:
            {
                
menu_additem(mVIPmenu"Kevler + Helm""1"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"Grenade Pack \r*""2"ADMIN_LEVEL_HmcbVIPMenu);
                
menu_additem(mVIPmenu"HP Bonus on Kill""3"ADMIN_LEVEL_H0);
            }
            case 
3:
            {
                
menu_additem(mVIPmenu"Kevler + Helm""1"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"Grenade Pack""2"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"HP Bonus on Kill \r*""3"ADMIN_LEVEL_HmcbVIPMenu);
            }
        }    
        
menu_setprop(mVIPmenuMPROP_EXITMEXIT_ALL);
        
/* Menu End */
        
menu_display(idmVIPmenu0);
        
        return 
PLUGIN_HANDLED;
    }
    else if(
VipUsed[id])
    {
        
client_printc(id"%s You Already used !gVIP Menu!n this round. Please wait until next round!"PREFIX);
    }
    else 
    {
        
client_printc(id"%s Only !gAdmins!n and !gVIPs!n may use the VIP Menu"PREFIX);
        return 
PLUGIN_HANDLED;
        
    }
    return 
PLUGIN_HANDLED;
}


/* Menu Choose VIP Feature: */

public mh_VipMenuHandler(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:
        {
            if(
nSelectedItem != key) {            
                
VipUsed[id] = true;            
                
nSelectedItem key;
                
client_printc(id"%s !gKevler!n and !gHelm!n will be added next round."PREFIX);
            }
            
        }
        case 
2:
        {
            if(
nSelectedItem != key) {            
                
VipUsed[id] = true;    
                
nSelectedItem key;
                
client_printc(id"%s !gGranade Pack!n will be added next round."PREFIX);
            }
        }
        case 
3:
        {
            if(
nSelectedItem != key) {            
                
VipUsed[id] = true;    
                
nSelectedItem key;
                
client_printc(id"%s !gHP Bonus!n will be added next round."PREFIX);
            }
        }
    }
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;        
    
}


/* Methode that will be called at next round start. */
public execOnNextRound(id) {
    switch(
nSelectedItem) {
        case 
1
        {        
            
give_item(id"item_assaultsuit");
            
set_user_armor(id100);
            
checkReceiveBonusHP[id] = false;
            
        }
        case 
2:
        {
            
give_item(id"weapon_hegrenade");
            
give_item(id"weapon_flashbang");
            
give_item(id"weapon_smokegrenade");
            
checkReceiveBonusHP[id] = false;
        }
        case 
3:
        {
            
checkReceiveBonusHP[id] = true;
        }
    }
}



// Colour Chat
stock client_printc(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);        
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
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();
            }
        }
    }

}



public 
mcb_VIPMenu(idmenuitem) {
/* This is the callback-event, here you can set items enabled or disabled. */
/* If you want to enable an item, use: return ITEM_ENABLED */
/* If you want to disable an item, use: return ITEM_DISABLED */
return ITEM_DISABLED;
}


public 
add_bonus_hp()
{
    
// Save our info.
    
new iAttacker read_data(1);
    
    if(
checkReceiveBonusHP[iAttacker]) 
    {
        new 
iVictim read_data(2);
        
        if(
is_user_alive(iAttacker) && iAttacker != iVictim && iAttacker != && get_user_team(iAttacker) != get_user_team(iVictim))
        {
            new 
iMaxHp get_pcvar_num(pMaxHp);
            new 
iHeadShot read_data(3);
        
            if(
iHeadShot)
            {
                
set_user_health(iAttackerclamp(get_user_health(iAttacker) + get_pcvar_num(pHeadShot), 0iMaxHp));
            }
            else
            {
                
set_user_health(iAttackerclamp(get_user_health(iAttacker) + get_pcvar_num(pKill), 0iMaxHp));
            }
        }
    }
    


Last edited by l00ka; 03-29-2020 at 09:44.
l00ka is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-29-2020 , 10:18   Re: VIP Menu Plugin problems with compiling
Reply With Quote #12

Made a small modification, try again.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
l00ka
Junior Member
Join Date: Sep 2012
Old 03-29-2020 , 10:49   Re: VIP Menu Plugin problems with compiling
Reply With Quote #13

Quote:
Originally Posted by Napoleon_be View Post
Made a small modification, try again.
After trying the result is the same.
l00ka is offline
l00ka
Junior Member
Join Date: Sep 2012
Old 03-30-2020 , 10:41   Re: VIP Menu Plugin problems with compiling
Reply With Quote #14

The problem is probably that the returned values from the natives and cvars do not correspond to what is expected. But why?
l00ka is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-30-2020 , 11:39   Re: VIP Menu Plugin problems with compiling
Reply With Quote #15

Is there another plugin that u use that sets health? I've read the code over and over again and can't seem to find the issue.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
l00ka
Junior Member
Join Date: Sep 2012
Old 03-30-2020 , 14:00   Re: VIP Menu Plugin problems with compiling
Reply With Quote #16

Quote:
Originally Posted by Napoleon_be View Post
Is there another plugin that u use that sets health? I've read the code over and over again and can't seem to find the issue.
I use only this plugins:
PHP Code:
AMX Mod X plugins

Admin Base Always one has to be activated
admin
.amxx        admin base (required for any admin-related)
;
admin_sql.amxx        admin base SQL version (comment admin.amxx)

Basic
admincmd
.amxx        basic admin console commands
adminhelp
.amxx        help command for admin console commands
adminslots
.amxx        slot reservation
multilingual
.amxx    Multi-Lingual management

Menus
menufront
.amxx        front-end for admin menus
cmdmenu
.amxx        command menu (speechsettings)
plmenu.amxx        players menu (kickbanclient cmds.)
;
telemenu.amxx        teleport menu (Fun Module required!)
mapsmenu.amxx        maps menu (votechangelevel)
pluginmenu.amxx        Menus for commands/cvars organized by plugin

Chat Messages
adminchat
.amxx        console chat commands
antiflood
.amxx        prevent clients from chat-flooding the server
scrollmsg
.amxx        displays a scrolling message
imessage
.amxx        displays information messages
adminvote
.amxx        vote commands

Map related
nextmap
.amxx        displays next map in mapcycle
mapchooser
.amxx        allows to vote for next map
timeleft
.amxx        displays time left on map

Configuration
pausecfg
.amxx        allows to pause and unpause some plugins
statscfg
.amxx        allows to manage stats plugins via menu and commands

Counter-Strike
;restmenu.amxx        restrict weapons menu
statsx
.amxx        stats on death or round end (CSX Module required!)
;
miscstats.amxx        bunch of events announcement for Counter-Strike
;stats_logging.amxx    weapons stats logging (CSX Module required!)

Enable to use AMX Mod plugins
;amxmod_compat.amxx    AMX Mod backwards compatibility layer

Custom Add 3rd party plugins here
amxx_podbotmenu
.amxx
VIP_Menu
.amxx 
It would be good to know if someone else have the same issue, with this plugin. Maybe my enviroment is wrong or something. I use a hlds server on my local computer to test it.

Is there a way to print in console or somewhere to watch the returned values of the natives and the cvar?
l00ka is offline
l00ka
Junior Member
Join Date: Sep 2012
Old 04-02-2020 , 11:39   Re: VIP Menu Plugin problems with compiling
Reply With Quote #17

I found the problem:

PHP Code:
 case 3:
            {
                
menu_additem(mVIPmenu"Kevler + Helm""1"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"Grenade Pack""2"ADMIN_LEVEL_H0);
                
menu_additem(mVIPmenu"HP Bonus on Kill \r*""3"ADMIN_LEVEL_HmcbVIPMenu);
            } 
should be

PHP Code:
 case 3:
            {
                
menu_additem(mVIPmenu"Kevler + Helm""1"0);
                
menu_additem(mVIPmenu"Grenade Pack""2",  0);
                
menu_additem(mVIPmenu"HP Bonus on Kill \r*""3"0mcbVIPMenu);
            } 
I don't know why 'ADMIN_LEVEL_H' made problems in that case, maybe because it is already used here
PHP Code:
register_clcmd("say vm""showVIPmenu"ADMIN_LEVEL_H); 
but I'm glad it works now.
l00ka 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 16:46.


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