AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   is_user_alive && get_pcvar_num (https://forums.alliedmods.net/showthread.php?t=241326)

CHE4TER 06-01-2014 11:57

is_user_alive && get_pcvar_num
 
What I'm doing wrong?
If the cvar is set to 1, the colorchat is displayed, it must display only if the player is not alive and cvar is set to 0

PHP Code:

public menuAdmin_handler(idmenu,item)
{
    switch(
item)
    {
        case 
0:
        {
            
// Check if Player is alive & CVARs that alow change team while alive/unalive
            
if(is_user_alive(id) && get_pcvar_num(sm_changeteam_alive) == 1changeTeam(id)
            if(
is_user_alive(id) && get_pcvar_num(sm_changeteam_alive) == 0changeTeam(id)
            else 
ColorChat(idNORMAL"You must be alive!")
            
sayMenu(id)
        }
    }



Baws 06-01-2014 12:22

Re: Help
 
You only check the pcvar once then the else.

Code:
if( get_pcvar_num( yourpcvar ) == 1 )     changeteam( id ); else Colorchat( id, NORMAL, "text" );

Why are you using a pcvar if the changeteam( id ) will be displayed in both of them?

devilicioux 06-02-2014 02:46

Re: Help
 
What exactly are you trying to do ? Allow menu access only if Admin is Alive ?

And Please

Quote:

Use descriptive topic titles. People should know at a glance of the title
what the thread is about.
Making a Thread with name HELP .. Doesnt really help even a bit.

fysiks 06-02-2014 02:52

Re: Help
 
The forum rules require that your topic title be descriptive. Please update your topic to describe your question or issue. If you fail to do so, you risk your threads being trashed.


All times are GMT -4. The time now is 09:36.

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