Raised This Month: $ Target: $400
 0% 

Voice Block - 3 warnings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maneljinho
Member
Join Date: Apr 2011
Old 02-14-2013 , 14:57   Voice Block - 3 warnings
Reply With Quote #1

close!

Last edited by maneljinho; 03-10-2013 at 19:56.
maneljinho is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-14-2013 , 15:19   Re: Voice Block - 3 warnings
Reply With Quote #2

You can ignore it. If you really want to fix it, search "loose indentation".
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
maneljinho
Member
Join Date: Apr 2011
Old 02-14-2013 , 15:23   Re: Voice Block - 3 warnings
Reply With Quote #3

close!

Last edited by maneljinho; 03-10-2013 at 19:57.
maneljinho is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 02-14-2013 , 15:54   Re: Voice Block - 3 warnings
Reply With Quote #4

Code:
CheckLastTerrorist()
{
    new players[32], pnum;
    get_players(players, pnum, "ae", "TERRORIST");
   
    g_last_terrorist = (pnum == 1) ? players[0] : 0;

   if(g_last_terrorist) {
   client_printcolor(0,"^4[CSNACIONAL] ^3O ultimo terrorista pode falar ao microfone." )
}
if(g_last_terrorist) {
  new players[32], num, player;
            get_players( players, num, "a" );
            
            for( new i = 0; i < num; i++ )
            {
                player = players[i];
                
                switch( cs_get_user_team( player ) )
                {
                    case CS_TEAM_CT:
                    {
                set_user_godmode( player, 0 );
                    }
                    
                    case CS_TEAM_T:
                    {
  
}

}
}
}

}
It should look like that:
Code:
CheckLastTerrorist()
{
	new players[32], pnum;
	get_players(players, pnum, "ae", "TERRORIST");
   
	g_last_terrorist = (pnum == 1) ? players[0] : 0;
	
	if(g_last_terrorist)
	{
		client_printcolor(0,"^4[CSNACIONAL] ^3O ultimo terrorista pode falar ao microfone." )
	}
	if(g_last_terrorist)
	{
		new players[32], num, player;
		get_players( players, num, "a" );
		
		for( new i = 0; i < num; i++ )
		{
			player = players[i];
		
			switch( cs_get_user_team( player ) )
			{
				case CS_TEAM_CT:
				{
					set_user_godmode( player, 0 );
				}
                    
				case CS_TEAM_T:
				{
					//code
				}

			}
		}
	}
}
Much better, ain't it?
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.

Last edited by naven; 02-14-2013 at 15:54.
naven is offline
leonardo_
Member
Join Date: Nov 2012
Location: Moscow, right now in Vic
Old 02-14-2013 , 15:55   Re: Voice Block - 3 warnings
Reply With Quote #5

Quote:
Originally Posted by maneljinho View Post
can tell me how to do it please?
You can ignore as wickedd said, or you need to change spaces in the code.

for example:
PHP Code:
CheckLastTerrorist()
{
    new 
players[32], pnum;
    
get_players(playerspnum"ae""TERRORIST");
   
    
g_last_terrorist = (pnum == 1) ? players[0] : 0;

  if(
g_last_terrorist) {
   
client_printcolor(0,"^4[CSNACIONAL] ^3O ultimo terrorista pode falar ao microfone." )

change into this:

PHP Code:
CheckLastTerrorist()
{
    new 
players[32], pnum;
    
get_players(playerspnum"ae""TERRORIST");
   
    
g_last_terrorist = (pnum == 1) ? players[0] : 0;

if(
g_last_terrorist) {
   
client_printcolor(0,"^4[CSNACIONAL] ^3O ultimo terrorista pode falar ao microfone." )

I only changed space in the front of if, that's it.

that line:
PHP Code:
if(g_last_terrorist) { 
This code should work: (try)
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <hamsandwich>
#include <fakemeta> 
#include <fun>
#include <cstrike>

#define ADMIN_VOICE ADMIN_IMMUNITY

#define OFFSET_TEAM 114 
#define fm_cs_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM) 

#define CS_TEAM_T 1 
#define CS_TEAM_CT 2 

new bool:g_connected[33]; 

new 
g_max_clients
new 
g_last_terrorist;


public 
plugin_init() 

    
register_plugin("No Terrorist Voice""0.1""Exolent"); 
    
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"1);
    
RegisterHam(Ham_Killed"player""FwdPlayerKilledPost"1);
    
    
register_forward(FM_Voice_SetClientListening"FwdSetVoice"); 
    
    
g_max_clients get_maxplayers(); 


public 
client_putinserver(client

    
g_connected[client] = true


public 
client_disconnect(client

    
g_connected[client] = false


public 
FwdPlayerSpawnPost(id)
{
    if( 
is_user_alive(id) )
    {
        
CheckLastTerrorist();
    }
}

public 
FwdPlayerKilledPost()
{
    
CheckLastTerrorist();
}

CheckLastTerrorist()
{
    new 
players[32], pnum;
    
get_players(playerspnum"ae""TERRORIST");
    
g_last_terrorist = (pnum == 1) ? players[0] : 0;
    
    if(
g_last_terrorist
    {
    
client_printcolor(0,"^4[CSNACIONAL] ^3O ultimo terrorista pode falar ao microfone." )
    }
    
    if(
g_last_terrorist) {
    new 
players[32], numplayer;
    
get_playersplayersnum"a" );
    
    
    for( new 
0numi++ )
    {
    
player players[i];
    
    switch( 
cs_get_user_teamplayer ) )
    {
    case 
CS_TEAM_CT:
    {
    
set_user_godmodeplayer);
    }
    case 
CS_TEAM_T:
    {
    
    }

}
}
}

}

public 
FwdSetVoice(receiversenderbool:listen

    if( !(
<= receiver <= g_max_clients
    || !
g_connected[receiver
    || !(
<= sender <= g_max_clients
    || !
g_connected[sender] ) return FMRES_IGNORED
    
    new 
team fm_cs_get_user_team(sender); 
    if( (
team == CS_TEAM_T && sender != g_last_terrorist || team == CS_TEAM_CT && !is_user_alive(sender)) && !access(senderADMIN_VOICE) ) 
    { 
        
engfunc(EngFunc_SetClientListeningreceiversender0); 
        return 
FMRES_SUPERCEDE
    } 
    
    return 
FMRES_IGNORED
}  


stock client_printcolor(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    static 
g_msgSayText_cpg_MaxPlayers_cp;
    if(!
g_msgSayText_cp) {
        
g_msgSayText_cp get_user_msgid("SayText");
    }
    if(!
g_MaxPlayers_cp) {
        
g_MaxPlayers_cp get_maxplayers();
    }

    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_MaxPlayers_cpplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
replace_all(buffercharsmax(buffer), "!g""^4");
            
replace_all(buffercharsmax(buffer), "!y""^1");
            
replace_all(buffercharsmax(buffer), "!t""^3");
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_cp_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
replace_all(buffercharsmax(buffer), "!g""^4");
        
replace_all(buffercharsmax(buffer), "!y""^1");
        
replace_all(buffercharsmax(buffer), "!t""^3");
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_cp_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

Hope that this information will be helpful for you.
__________________
www.Deagle-Shot.ru - Game Community
leonardo_ is offline
Send a message via ICQ to leonardo_ Send a message via Skype™ to leonardo_
maneljinho
Member
Join Date: Apr 2011
Old 02-14-2013 , 15:58   Re: Voice Block - 3 warnings
Reply With Quote #6

close!

Last edited by maneljinho; 03-10-2013 at 19:57.
maneljinho 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 20:29.


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