AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Something wrong. Doesn't print message. (https://forums.alliedmods.net/showthread.php?t=209067)

Unkolix 02-20-2013 17:07

Something wrong. Doesn't print message.
 
So, as I have promised I am remaking Dunn0's VIP plugin and I am doing quite well with whole Allied Modders community. But I have few problems. This code doesn't print the message...
PHP Code:

public cmdvipmenu(id
{
    if ( 
is_user_alive(id) )
    {
        if (
get_user_flags(id) & ADMIN_LEVEL_H)
        {
            if ( 
gMenuUsed[id] == menu_uses )
            {
                
client_printidprint_center"%L"id"VIP_MENU_PER_ROUND"menu_uses );
            }
        }
    }
    return 
PLUGIN_HANDLED;


P.S. It's only a part from cmdvipmenu, that doesn't work, everything else does.

YamiKaitou 02-20-2013 17:10

Re: Something wrong. Doesn't print message.
 
Then one of the if statements is returning false

Unkolix 02-20-2013 17:20

Re: Something wrong. Doesn't print message.
 
Here, it's the whole cmdvipmenu, don't know what's wrong :/
PHP Code:

public cmdvipmenu(id
{
    if ( 
is_user_alive(id) )
    {
        if (
get_user_flags(id) & ADMIN_LEVEL_H//Checks if player has flag H
        
{
            if ( 
CurrentRound menu_round )
            {
                
client_printidprint_center"%L"id"VIP_MENU_ROUND" ); //Sends a message that VIP can use VIP menu only from specific round
            
}
            if ( 
map_active == //Checks if map_active is 1
            
{
                if( 
g_bCurrentMapIsInList //Checks if current map is in mapnames list
                
{
                    
client_printidprint_center"%L"id"VIP_MENU_WRONG_MAP" ); //Sends a message that VIP can't use VIP menu on that map
                
}
            }
            if ( 
gMenuUsed[id] == menu_uses )
            {
                
client_printidprint_center"%L"id"VIP_MENU_PER_ROUND"menu_uses ); //Message that VIP can only take VIP menu few time that is set as VIPUsed
            
}
            if ( !
g_freezetime && is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H //Checks if freezetime is not over yet and if user is alive and he has flag H
            
{
                
client_printidprint_center"%L"id"VIP_MENU_ONLY_FROM_ROUND_START" ); //Message that's set in vipplugin.txt as VIP_MENU_ONLY_FROM_ROUND_START
            
}
            if(
g_freezetime//Checks if freezetime is over
            
{
                if ( 
gMenuUsed[id] <= menu_uses //Checks if VIP has already used VIP menu before, the amount of times we set as VIPUsed 
                
{
                    if( 
CurrentRound >= menu_round //Checks if current round is more or equal to the round that is set as VIPMenuRound
                    
{    
                        if (!
get_pcvar_num(g_menu_active)) //Checks if g_menu_active is disactivated (set to 0)
                            
return PLUGIN_CONTINUE //If so, VIP won't get VIP menu
                        
Showrod(id//Shows VIP menu
                    
}
                }
            }
        }
        if (!(
get_user_flags(id) & ADMIN_LEVEL_H)) //Checks if user doesn't has flag H
        
{
            
set_task(0.1"PrintText" ,id//Sets a task in 0.1 seconds and starts PrintTect
        
}
    }
    if ( !
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H //Checks if user is death and he has admin flag H
    
{
        
client_printidprint_center"%L"id"VIP_MENU_MUST_BE_ALIVE" ); //Sends a message that VIP must be alive to use VIP menu
    
}
    if (!
is_user_alive(id) && !(get_user_flags(id) & ADMIN_LEVEL_H)) //Checks if user doesn't has flag H
    
{
        
set_task(0.1"PrintText" ,id//Sets a task in 0.1 seconds and starts PrintTect
    
}
    return 
PLUGIN_HANDLED;



wickedd 02-20-2013 17:26

Re: Something wrong. Doesn't print message.
 
You're going to rewrite Dunn0's VIP plugin?

Unkolix 02-20-2013 17:30

Re: Something wrong. Doesn't print message.
 
*sigh* still doesn't work when server is restarted, on the first round.

fysiks 02-20-2013 20:51

Re: Something wrong. Doesn't print message.
 
Find out what condition is false that shouldn't be. Also, there is no reason to use a task for 0.1 seconds there. Just call the function directly.

ConnorMcLeod 02-21-2013 01:08

Re: Something wrong. Doesn't print message.
 
Quote:

Originally Posted by YamiKaitou (Post 1898533)
Then one of the if statements is returning false

or cmdvipmenu is never called.

Unkolix 02-21-2013 03:09

Re: Something wrong. Doesn't print message.
 
But everything else works... I believe that something is wrong whit menu_uses cvar... Can't find anything wrong.

EDIT: I fixed it, don't know how :D

P.S. ConnorMcLeod, I sent you a private message about your strip weapons stock, I don't understand how to make it work. Please send me your answer via private message, or here. It is my last problem with the plugin. Thanks.


All times are GMT -4. The time now is 21:43.

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