Raised This Month: $ Target: $400
 0% 

VIP Menu - Server will not start


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amigosaostiroos
Senior Member
Join Date: Sep 2010
Location: Portugal
Old 04-18-2011 , 13:40   VIP Menu - Server will not start
Reply With Quote #1

I made this plugin through others.
I put the plugin to test and I changed my map on the server ...
the server does not start.

Someone can review the plugin, because I reviewed and not discovered the problem?

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "[Amigos aos tirOs'] Menu VIP"
#define VERSION "1.0"
#define AUTHOR "Amigos aos tirOs"

#define ADMIN_FURIENVIP ADMIN_LEVEL_B

new const g_szAk47Model[] = "models/furien/v_golden_ak47.mdl";
new const g_szDeagleModel[] = "models/furien/v_deagle.mdl";

new VipUsed[33];

new bool:g_bHasAk47[33];
new bool:g_bHasDeagle[33];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1);
    RegisterHam(Ham_Item_PreFrame, "player", "FwdPreFrame_Post", 1);
    
    register_event("CurWeapon","event_curweapon","be","1=1");
    
    register_clcmd("say vipmenu", "cmdVmenu");
    register_clcmd("say /vipmenu", "cmdVmenu");
}

public plugin_precache()
{
    precache_model(g_szAk47Model);
    precache_model(g_szDeagleModel);
}

public event_curweapon(id)
{
    if(g_bHasAk47[id] && read_data(2) == CSW_AK47)
    {
        set_pev(id, pev_viewmodel2, g_szAk47Model);
        set_user_gravity(id, 1.0);
    }
    
    else
        set_user_gravity(id, 1.0);
    if(g_bHasDeagle[id] && read_data(2) == CSW_DEAGLE)
    {
        set_pev(id, pev_viewmodel2, g_szDeagleModel);
        set_user_gravity(id, 0.5);
    }
    
    else
        set_user_gravity(id, 1.0);
}

public FwdPreFrame_Post(id)
{
    if(!is_user_alive(id))
    {
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_HANDLED;
}

public FwdHamSpawn_Post(id)
{
    if (!is_user_alive(id))
        return PLUGIN_CONTINUE;
    
    VipUsed[id] = false;
    g_bHasAk47[id] = false; 
    g_bHasDeagle[id] = false;
    return PLUGIN_CONTINUE;
}  

public cmdVmenu(id)
{
    if(!(get_user_flags(id) & ADMIN_FURIENVIP))
    {
        ChatColor(id, "!g[Amigos aos tirOs'] !tAcesso Proibido! Acesso a VIPs!");
        
        return PLUGIN_HANDLED;
    }
    
    if(VipUsed[id])
    {
        ChatColor(id, "!g[Amigos aos tirOs'] !tMenu Utilizado 1 Vez!");
        
        return PLUGIN_HANDLED;
    }
    
    switch(cs_get_user_team(id))
    {
        case CS_TEAM_T:
            VIPTMenu(id);
        
        case CS_TEAM_CT:
            VIPCTMenu(id);
    }
    
    return PLUGIN_HANDLED;
}

public VIPCTMenu(id)
{
    new menu = menu_create("\r[Amigos aos tirOs'] \yMenu VIP CT\d:^n", "VIPCTMenu_Handler");
    
    menu_additem(menu, "\w150HP e 100ARMADURA", "1", 0);
    menu_additem(menu, "\wREVIVE", "2", 0);
    menu_additem(menu, "\wM249 e DEAGLE", "3", 0);
    menu_additem(menu, "\wGOLDEN AK47", "4", 0);
    menu_additem(menu, "\wGOLDEN DEAGLE", "5", 0);
    
    menu_setprop(menu, MPROP_EXITNAME, "Sair" );
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    
    menu_display(id, menu);
}

public VIPCTMenu_Handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    
    switch(key)
    {
        case 1:
        {
            set_user_health(id, get_user_health(id) + 150);
            set_user_armor(id, get_user_armor(id) + 100);
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(HP e Armadura)!");
        }
        case 2:
        {
            ExecuteHamB(Ham_CS_RoundRespawn, id);
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(REVIVE)!");
        }
        case 3:
        {
            give_item(id, "weapon_m249");
            give_item(id, "weapon_deagle");
            cs_set_user_bpammo(id, CSW_M249, 250);
            cs_set_user_bpammo(id, CSW_DEAGLE, 70);
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(M249 e DEAGLE)!");
        }
        case 4:
        {
            give_item(id, "weapon_ak47");
            cs_set_user_bpammo(id, CSW_AK47, 125);
            set_pev(id, pev_viewmodel2, "models/furien/v_golden_ak47.mdl");
            g_bHasAk47[id] = true;
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(GOLDEN AK47)!");
        }
        case 5:
        {
            give_item(id, "weapon_deagle");
            cs_set_user_bpammo(id, CSW_DEAGLE, 35);
            set_pev(id, pev_viewmodel2, "models/furien/v_deagle.mdl");
            g_bHasDeagle[id] = true;
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(GOLDEN DEAGLE)!");
        }
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public VIPTMenu(id)
{
    new menu = menu_create("\r[Amigos aos tirOs'] \yMenu VIP T\d:^n", "VIPTMenu_Handler");
    
    menu_additem(menu, "\w150HP e 100ARMADURA", "1", 0);
    menu_additem(menu, "\wREVIVE", "2", 0);
    
    menu_setprop(menu, MPROP_EXITNAME, "Sair" );
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    
    menu_display(id, menu);
}

public VIPTMenu_Handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    
    new key = str_to_num(data);
    
    switch(key)
    {
        case 1:
        {
            set_user_health(id, get_user_health(id) + 150);
            set_user_armor(id, get_user_armor(id) + 100);
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(HP e Armadura)!");
        }
        case 2:
        {
            ExecuteHamB(Ham_CS_RoundRespawn, id);
            VipUsed[id] = true;
            ChatColor(id, "!g[Amigos aos tirOs'] !tItem Recebido !y(REVIVE)!");
        }
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

stock ChatColor(const id, const input[], any:...) 
{ 
    new count = 1, players[32] 
    static msg[191] 
    vformat(msg, 190, input, 3) 
    
    replace_all(msg, 190, "!g", "^4") // Green Color 
    replace_all(msg, 190, "!y", "^1") // Default Color 
    replace_all(msg, 190, "!t", "^3") // Team Color
    
    if (id) players[0] = id; else get_players(players, count, "ch") 
    { 
        for (new i = 0; i < count; i++) 
        { 
            if (is_user_connected(players[i])) 
            { 
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
            write_byte(players[i]);
            write_string(msg);
            message_end();
            } 
        } 
    } 
}
__________________
www.AmiGosaostirOs.com - Comunidade PortuGuesa de Counter-Strike

Last edited by amigosaostiroos; 04-19-2011 at 16:22.
amigosaostiroos is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-18-2011 , 13:53   Re: VIP Menu - Server will not start
Reply With Quote #2

Errors in the server console?
__________________
fysiks is offline
amigosaostiroos
Senior Member
Join Date: Sep 2010
Location: Portugal
Old 04-18-2011 , 14:13   Re: VIP Menu - Server will not start
Reply With Quote #3

the server not starts
__________________
www.AmiGosaostirOs.com - Comunidade PortuGuesa de Counter-Strike
amigosaostiroos is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-18-2011 , 14:52   Re: VIP Menu - Server will not start
Reply With Quote #4

Quote:
Originally Posted by amigosaostiroos View Post
the server not starts
That doesn't answer my question. Often there is an error showing the in the server console when the server does not start (Note: You cannot see it via HLSW).
__________________
fysiks is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-18-2011 , 15:02   Re: VIP Menu - Server will not start
Reply With Quote #5

Are you sure you have the 2 models you're precaching on the server ?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
amigosaostiroos
Senior Member
Join Date: Sep 2010
Location: Portugal
Old 04-18-2011 , 18:00   Re: VIP Menu - Server will not start
Reply With Quote #6

yes, I put de models!
__________________
www.AmiGosaostirOs.com - Comunidade PortuGuesa de Counter-Strike
amigosaostiroos is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-18-2011 , 18:04   Re: VIP Menu - Server will not start
Reply With Quote #7

I've tried running the plugin with default models and my server worked fine.
Maybe you made a typo in the model name or something.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
amigosaostiroos
Senior Member
Join Date: Sep 2010
Location: Portugal
Old 04-18-2011 , 18:07   Re: VIP Menu - Server will not start
Reply With Quote #8

now, the server worked fine, but the menu not appears -.-
__________________
www.AmiGosaostirOs.com - Comunidade PortuGuesa de Counter-Strike
amigosaostiroos is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-18-2011 , 20:54   Re: VIP Menu - Server will not start
Reply With Quote #9

When a plugin isn't working like it should, you should check for runtime-errors.

Code:
L 04/19/2011 - 02:53:39: Invalid function "VIPCTMenu_Handler"
L 04/19/2011 - 02:53:39: [AMXX] Displaying debug trace (plugin "test.amxx")
L 04/19/2011 - 02:53:39: [AMXX] Run time error 19: function not found 
L 04/19/2011 - 02:53:39: [AMXX]    [0] test.sma::VIPCTMenu (line 101)
L 04/19/2011 - 02:53:39: [AMXX]    [1] test.sma::cmdVmenu (line 93)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
amigosaostiroos
Senior Member
Join Date: Sep 2010
Location: Portugal
Old 04-19-2011 , 15:10   Re: VIP Menu - Server will not start
Reply With Quote #10

can tell me if the plugin is correct for permanent use?
__________________
www.AmiGosaostirOs.com - Comunidade PortuGuesa de Counter-Strike

Last edited by amigosaostiroos; 04-19-2011 at 16:39.
amigosaostiroos 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 20:03.


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