AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin work, Does not show anything (https://forums.alliedmods.net/showthread.php?t=233871)

Snitch 01-21-2014 06:12

Plugin work, Does not show anything
 
That Only Open the menu - /hats - when i press 1/2/3/4 nothing show, must be a level..

but /level other commands nothing working
PHP Code:

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <cstrike>
#include <fun>
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
new const gszdevil[] = "models/player/amxx/devil.mdl";  
new const 
gszafro[] = "models/player/amxx/afro.mdl";  
new const 
gszbeer[] = "models/player/amxx/beer.mdl";   
new const 
gszheadphones[] = "models/player/amxx/headphones.mdl";  
 
new const 
LEVELS[4] =
{
    
0,
    
10,
    
20,
    
40
    
    
    
}
 
new 
PlayerXP[33], PlayerLevel[33]
new 
Xp_Kill,XP_Hs,SaveXP,XP_Round
new g_vault
 
public plugin_init() {
       
        
g_vault nvault_open("HatSystem")
       
        
//Event
        
register_event("DeathMsg""eDeath""a")
       
        
//Is Saving on?
        
SaveXP register_cvar("SaveXP","1")
       
        
register_logevent"Event_RoundEnd"2"1=Round_End" );
       
        
//Xp/Kill
        
Xp_Kill=register_cvar("XP_per_kill""6")
       
        
//HsBonus
        
XP_Hs=register_cvar("XP_hs_bonus","6")
        
XP_Round=register_cvar("XP_Round","10")
       
        
//Rewards
        
register_clcmd"say /hats","Hats_Handler");
        
register_clcmd"say_tean /hats","Hats_Handler");
       
        
//Checking Points/Level
    
register_clcmd("say /level""ShowHud")
    
register_clcmd("say /mylevel""ShowHud")
}
 
public 
eDeath()
{
    new 
attacker read_data)
    new 
headshot read_data)
       
        if( !( 
<= attacker <= 32 )
        || !
is_user_aliveattacker ) )
        {
                return;
        }
       
        if(
headshot)
        {
                
PlayerXP[attacker] += get_pcvar_num(Xp_Kill)
                
client_print(attackerprint_chat"You got bonus %i for killing with a HeadShot!"get_pcvar_num(  XP_Hs ))
        }
       
        
PlayerXP[attacker] += get_pcvar_num(Xp_Kill)
       
        while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
        { 
// this will create the Congratulations message.
                
client_print(attackerprint_chat"[%s] Congratulations! You are a level %i!"PlayerLevel[attacker]);
                
// Add his/her level
                
PlayerLevel[attacker]++
        }
        
// shows his level on a hud message
        
ShowHud(attacker)
}

// /Ps command.
public ShowHud(id)
{
        
client_print(idprint_chat" Level: %i | XP: %i"PlayerLevel[id],PlayerXP[id])
}
 
//Bonus When round ends-------------------------------------------------------------------------
public Event_RoundEnd( )
{
        new 
szPlayers32 ], iPlayerCountiNumid;
        
get_playersszPlayersiPlayerCount"e""TERRORIST" );
       
        for( 
iNum 0iNum iPlayerCountiNum++ )
        {
                
id szPlayersiNum ];
               
                if( 
is_user_aliveid ) )
                {
                        
PlayerXPid ] += get_pcvar_numXP_Round );
                        
client_print(idprint_chat"You got %i for survived the round!"get_pcvar_numXP_Round ))
                       
                        while(
PlayerXP[id] >= LEVELS[PlayerLevel[id]])
                        { 
// this will create the Congratulations message.
                                
client_print(idprint_chat"[%s] Congratulations! You are a level %i!"PlayerLevel[id]);
                                
// Add his/her level
                                
PlayerLevel[id] += 1
                        
}
                }
        }
}
 
 
//Rewards-------------------------------------------------------------------------
 
public plugin_precache()
{
        
precache_model(gszdevil)
        
precache_model(gszafro)
        
precache_model(gszbeer)
        
precache_model(gszheadphones)
}
 
 
public 
Hats_Handler(id)
{
    new 
menu menu_create("\r[AMXX] \wTest Mod:""menu_handler");
 
    
menu_additem(menu"Devil Hat \d- \r[ \wLevel \d- \y5 \r]""1");
    
menu_additem(menu"Afro Hat \d- \r[ \wLevel \d- \y10 \r]""2");
    
menu_additem(menu"Beer Hat \d- \r[ \wLevel \d- \y15 \r]""3");
    
menu_additem(menu"Headphones Hat \d- \r[ \wLevel \d- \y20 \r]""4");
    
menu_additem(menu"\wReset\w/\wRemove My Hat""5"0);
 
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
    
menu_display(idmenu0);
    
    return 
1;
}
 
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);
       
    switch(
data[0])
    {
    case 
0:
    {
    if(
PlayerLevel[id]<=5)
    {
    
client_print(idprint_chat"You Need to be level 5 for this!")
    }
                       
    if(
PlayerLevel[id]>=5)
    {
    if(
cs_get_user_team(id)==CS_TEAM_CT)
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"devil")
    }
    else
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"devil")
    }
    }
}
    case 
1:
    {    
    if(
PlayerLevel[id]<=10)
    {
    
client_print(idprint_chat"You Need to be level 10 for this!")
    }
            
    if(
PlayerLevel[id]>=10)
    {
    if(
cs_get_user_team(id)==CS_TEAM_CT)
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"afro")
    }
    else
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"afro")  
    }
    }
}
        
    case 
3:
    {
    if(
PlayerLevel[id]<=15)
    {
    
client_print(idprint_chat"You Need to be level 15 for this!")
    }
            
    if(
PlayerLevel[id]>=15)
    {
    if(
cs_get_user_team(id)==CS_TEAM_CT)
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"beer")
    }
    else
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"beer")  
    }
    }    
}
    case 
4:
    {
    if(
PlayerLevel[id]<=20)
    {
    
client_print(idprint_chat"You Need to be level 20 for this!")
    }
            
    if(
PlayerLevel[id]>=20)
    {
                
    if(
cs_get_user_team(id)==CS_TEAM_CT)
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"headphones")
    }
    else
    {
    
cs_reset_user_modelid )
    
cs_set_user_modelid"headphones")
    }
    }
}
                       
    case 
5:
    {
    
cs_reset_user_modelid )
    }
}
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED;



hornet 01-21-2014 06:15

Re: Plugin work, Does not show anything
 
The function needs to be public.

Snitch 01-21-2014 06:19

Re: Plugin work, Does not show anything
 
Quote:

Originally Posted by hornet (Post 2088946)
The function needs to be public.

ahh Thanks for it. i edit my Thread check it please :)

what about that:
Quote:

new const LEVELS[21] =
no work for me :(

Snitch 05-17-2014 08:29

Re: Plugin work, Does not show anything
 
bump?

Black Rose 05-17-2014 09:15

Re: Plugin work, Does not show anything
 
What is it that isn't working?
I don't want to install the plugin to find that out.

HamletEagle 05-17-2014 09:26

Re: Plugin work, Does not show anything
 
Show debug log:
-Add debug in plugins.ini right after plugin name: if the plugin is called name will be name debug.

Then look in server's console and post here the debug log.

Snitch 11-23-2014 16:45

Re: Plugin work, Does not show anything
 
bump

zmd94 11-23-2014 21:02

Re: Plugin work, Does not show anything
 
Please show the full code and the errors that you get?

Snitch 11-24-2014 09:48

Re: Plugin work, Does not show anything
 
Quote:

Originally Posted by zmd94 (Post 2227605)
Please show the full code and the errors that you get?

this is my full code.

just the menu not open to me.

i just want when u lvl up u can get [take] a hat for your level.
but if u not Lv 10, so u can't bought it.

and i guess i missed exp to level.
so i dunno.

zmd94 11-25-2014 03:12

Re: Plugin work, Does not show anything
 
Where is the part of code that use to save the experiences?


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

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