Raised This Month: $ Target: $400
 0% 

CT team can have max 4 ct's players.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-09-2009 , 11:31   CT team can have max 4 ct's players.
Reply With Quote #1

So this code worst coded and cause a lot of bugs ,maybe someone can give me better code?
In ct team can be max 4 players,this code buggy I don't how ,but somehow in team can be more than 4 players and when round starts(and 4 players in ct team) then one of them are switched to terrorist team and who was switched he is in ct base!.
So anyone can give a good working code?

Quote:
public message_teaminfo(msg_id, msg_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(2, team, sizeof team - 1)
if(team[0] == 'U' || team[0] == 'S') return;
new cts = ckrun_get_ct_num()
if(cts >= 4){
cs_set_user_team(id, CS_TEAM_T, CS_DONTCHANGE)
set_msg_arg_string(2, "TERRORIST")
}
Quote:
stock ckrun_get_ct_num(){
new num = 0 , i
for (i = 1; i <= g_maxplayers; i++){
if (is_user_connected(i) && get_user_team(i) == 2)
num ++
}
return num
}
And register this message in plugin_init:
Quote:
register_message(get_user_msgid("TeamInfo"), "message_teaminfo")
xbatista is offline
Send a message via Skype™ to xbatista
 


Thread Tools
Display Modes

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:15.


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