Raised This Month: $ Target: $400
 0% 

[HELP] If user spectator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JoaoVieira
Senior Member
Join Date: May 2013
Location: Portugal
Old 09-02-2016 , 16:39   [HELP] If user spectator
Reply With Quote #1

Hi , i wan't to know how can i do to dont allow spectator to use an case.
I wanted to put it in here:
PHP Code:
        case 5
    {
    if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR )
    {
    if(!
is_user_alive(id)) 
        {
            if(
hasRespawn[id] == false
        {
                if(
g_Points[id] >= price5
        {
          
g_Points[id] -= price5
          ExecuteHamB
(Ham_CS_RoundRespawnid)
    
          
hasRespawn[id] = true
          DisplayMenu
(id
                }   
                else 
       {
           
                }
            }
            else 
    {
               
            }
       }
            else 
    {

            }
       }
            else 
    {
            
            }
}
}
    
menu_destroy(menu)


Last edited by JoaoVieira; 09-02-2016 at 16:39.
JoaoVieira is offline
pupdebox
Senior Member
Join Date: Feb 2016
Location: Wakanda
Old 09-02-2016 , 17:00   Re: [HELP] If user spectator
Reply With Quote #2

Code:
case 5: 
{
	if(cs_get_user_team(id) == CS_TEAM_SPECTATOR )
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	if(!is_user_alive(id)) 
	{
		if(hasRespawn[id] == false) 
		{
			if(g_Points[id] >= price5) 
			{
				g_Points[id] -= price5
				ExecuteHamB(Ham_CS_RoundRespawn, id)
				
				hasRespawn[id] = true
				DisplayMenu(id) 
			}   
			else 
			{
				
			}
		}
		else 
		{
			
		}
	}
	else 
	{
		
	}
	else 
	{
		
	}
}
menu_destroy(menu)
return PLUGIN_CONTINUE
}
Edit:added menu_destroy(menu) before PLUGIN_HANDLED to make sure you don't get errors

Last edited by pupdebox; 09-02-2016 at 17:09.
pupdebox is offline
JoaoVieira
Senior Member
Join Date: May 2013
Location: Portugal
Old 09-02-2016 , 17:06   Re: [HELP] If user spectator
Reply With Quote #3

Thanks.
JoaoVieira is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-03-2016 , 11:42   Re: [HELP] If user spectator
Reply With Quote #4

Why so many empty else clauses?
klippy is offline
JoaoVieira
Senior Member
Join Date: May 2013
Location: Portugal
Old 09-03-2016 , 11:52   Re: [HELP] If user spectator
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
Why so many empty else clauses?
PHP Code:
        case 5
    {
    if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
    {
        
ColorChat(idGREEN"[ AMXX ]^1 Nao podes ser ^3espectador^1 para utilizar este ^4comando^1!")
        return 
PLUGIN_HANDLED
    
}
    if(!
is_user_alive(id)) 
        {
            if(
hasRespawn[id] == false
        {
                if(
g_Points[id] >= price5
        {
          
g_Points[id] -= price5
          ExecuteHamB
(Ham_CS_RoundRespawnid)
          
ColorChat(idGREEN"[ AMXX ]^1 Compraste Respawn por ^x03%d^x01 Pontos"get_pcvar_num(pCvarPreco4))
          
hasRespawn[id] = true
          DisplayMenu
(id
                }   
                else 
       {
                    
ColorChat(idGREEN"[ AMXX ]^1 Nao tens pontos suficientes.")
                }
            }
            else 
    {
            
DisplayMenu(id
                
ColorChat(idGREEN"[ AMXX ]^1 So podes comprar este item uma vez por ronda.")
            }
       }
            else 
    {
             
ColorChat(idGREEN"[ AMXX ]^1 Tens de estar ^3morto^1 para usar este comando.")
            }
       }
}
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

JoaoVieira 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 01:44.


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