Raised This Month: $ Target: $400
 0% 

is_user_alive && get_pcvar_num


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CHE4TER
Member
Join Date: Jul 2013
Location: Portugal
Old 06-01-2014 , 11:57   is_user_alive && get_pcvar_num
Reply With Quote #1

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)
        }
    }


Last edited by CHE4TER; 06-02-2014 at 07:27.
CHE4TER is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 06-01-2014 , 12:22   Re: Help
Reply With Quote #2

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?
__________________
Like my clean plugins and work?
Baws is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 06-02-2014 , 02:46   Re: Help
Reply With Quote #3

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.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-02-2014 , 02:52   Re: Help
Reply With Quote #4

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.
__________________
fysiks 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 09:36.


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