Raised This Month: $ Target: $400
 0% 

Two get_user_msgid("TeamInfo")


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-04-2009 , 12:59   Two get_user_msgid("TeamInfo")
Reply With Quote #1

OK I have this.
In plugin init.

PHP Code:
new g_maxplayers
new p_On
new bool:g_bSwitch33 
PHP Code:
register_message(get_user_msgid("TeamInfo"), "message_teaminfo")

        
p_On register_cvar"amx_stbk""1" // 1 = switching teams.
        
g_maxplayers get_maxplayers()
        
register_event"HLTV""ev_newRound""a""1=0""2=0" )
        
register_event"DeathMsg""ev_Death""a" )
        
register_messageget_user_msgid"TeamInfo" ), "msg_TeamInfo" )

///Here is the in the ct team can be max 4 ct's///
public message_teaminfo(msg_idmsg_dest){
     if (
msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return;
     new 
id get_msg_arg_int(1)
     static 
team[2]
     
get_msg_arg_string(2teamsizeof team 1)
     if(
team[0] == 'U' || team[0] == 'S') return;
     new 
cts ckrun_get_ct_num()
     if(
cts >= 4){
     
cs_set_user_team(idCS_TEAM_TCS_DONTCHANGE)
     
set_msg_arg_string(2"TERRORIST")
     }
}
stock ckrun_get_ct_num(){
      new 
num i
      
for (1<= g_maxplayersi++){
      if (
is_user_connected(i) && get_user_team(i) == 2)
      
num ++
      }
      return 
num
}
///Switching teams, If terrorist killed ct switch their teams///
public client_disconnect(id)
{
       
g_bSwitchid ] = false
}
public 
ev_Death()
{
    if( !
get_pcvar_nump_On ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
iAtt iAtt read_data);
    if( !( 
<= iAtt <= g_maxplayers ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
iVic iVic read_data);
    if( !( 
<= iVic <= g_maxplayers ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
cs_get_user_teamiAtt ) == CS_TEAM_T && cs_get_user_teamiVic ) == CS_TEAM_CT )
    {
        if( !
g_bSwitchiAtt ] )
        {
            
g_bSwitchiAtt ] = true;
            
            if( !
g_bSwitchiVic ] )
            {
                
g_bSwitchiVic ] = true;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
msg_TeamInfomidDestid )
{
    if( 
Dest != MSG_ALL && Dest != MSG_BROADCAST )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( !
get_pcvar_nump_On ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_bSwitchid ] )
    {
        
g_bSwitchid ] = false;
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
ev_newRound()
{
    if( !
get_pcvar_nump_On ) )
    {
        return;
    }
    
    static 
iCsTeams:team;
    for( 
<= g_maxplayers i++ )
    {
        if( !
is_user_connected) || !g_bSwitch]
        || !( 
CS_TEAM_UNASSIGNED < ( team cs_get_user_team) ) < CS_TEAM_SPECTATOR ) )
            continue;
        
        
cs_set_user_teami, ( team CS_TEAM_CT ) + CS_TEAM_T );
        
g_bSwitch] = false;
    }

This is good if I'm using 2 Team info?
And this codes together worst working,maybe someone can configure it?

Last edited by xbatista; 01-04-2009 at 13:02.
xbatista is offline
Send a message via Skype™ to xbatista
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-04-2009 , 16:46   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #2

So my code didn't work for you eh?
I really don't understand, as it works fine for me.
Put my code at the top of the list at plugins.ini and try then.
If it doesn't work, I hope someone will find a solution for you.

And if you want your function to work instead of mine:
Code:
register_message( get_user_msgid( "TeamInfo" ), "msg_TeamInfo" ) ---> register_message( get_user_msgid( "TeamInfo" ), "message_teaminfo" ) // and remove my function
But what you're trying to do is pointless, as the rest of the plugin will switch their teams anyways...
Why didn't you ask me...
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 01-04-2009 at 16:50.
Dores is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-05-2009 , 08:47   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #3

Dores I just thing that 2 codes worst working.
P.S.Your code working ,but buggy,I don't know how but sometimes terrorist's spawns in ct's spawn when switching,I don't say always ,but sometimes :/
And thanks for trying help,suggest ;)
And yes your code works but buggy :/
Dores I'm asking you and other people :}

And this code may cause those bugs for switching?
PHP Code:
///Here is the in the ct team can be max 4 ct's/// 
public message_teaminfo(msg_idmsg_dest){ 
     if (
msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return; 
     new 
id get_msg_arg_int(1
     static 
team[2
     
get_msg_arg_string(2teamsizeof team 1
     if(
team[0] == 'U' || team[0] == 'S') return; 
     new 
cts ckrun_get_ct_num() 
     if(
cts >= 4){ 
     
cs_set_user_team(idCS_TEAM_TCS_DONTCHANGE
     
set_msg_arg_string(2"TERRORIST"
     } 
}
stock ckrun_get_ct_num(){ 
      new 
num 
      
for (1<= g_maxplayersi++){ 
      if (
is_user_connected(i) && get_user_team(i) == 2
      
num ++ 
      } 
      return 
num 


Last edited by xbatista; 01-05-2009 at 09:09.
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-05-2009 , 08:57   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #4

huh check his sig o.O'
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-05-2009 , 09:06   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #5

???
EDIT: Ahh yes
((

Last edited by xbatista; 01-06-2009 at 08:46.
xbatista is offline
Send a message via Skype™ to xbatista
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-05-2009 , 10:04   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #6

Quote:
Originally Posted by xbatista View Post
???
EDIT: Ahh yes
((
What was that ""? Mah, like "You did this to him!"... Anyway...
SnoW is offline
Send a message via MSN to SnoW
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-06-2009 , 08:46   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #7

No... I've asking not only him about the problem,but to all.
xbatista is offline
Send a message via Skype™ to xbatista
Old 01-06-2009, 09:03
SnoW
This message has been deleted by SnoW. Reason: I just stop off-topic talking...
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-07-2009 , 07:49   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #8

i wasn't angry at you, xbatista, i was angry because my codes never work.
ignore what i said...
Dores is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-07-2009 , 08:47   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #9

ah always have same problem my codes never work clean -.-` if its more than 100 lines like DRM
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-07-2009 , 08:54   Re: Two get_user_msgid("TeamInfo")
Reply With Quote #10

No Dores,your code works,but little buggy ;)

So how about the team info?That 1-st code of max in CT team can be 4 players good coded?
xbatista is offline
Send a message via Skype™ to xbatista
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:11.


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