Raised This Month: $ Target: $400
 0% 

scripting help team divide


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-15-2011 , 13:31   Re: scripting help team divide
Reply With Quote #1

Quote:
Originally Posted by Exolent[jNr] View Post
You are checking player count before you get players.

PHP Code:
public team_up(id
{

    if (
cs_get_user_team(id) == CS_TEAM_CT && is_user_alive(id))
    {
        
        new 
playerCount
        
new Players[32
                
        
get_players(PlayersplayerCount"ae""TERRORIST"
        
        new 
iExtraPlayers playerCount 2
        
        
if (iExtraPlayers
        {
            
ColorChat(idRED"[JailBreak]^x04 Cannot Divide the^x03 Team^x04")
        }
        else
        {
            
entity_set_int(Players[i], EV_INT_skinrandom_num(01))
            
color_view(Players[i])
        }
    }


Last edited by r0ck; 08-24-2011 at 08:52.
r0ck is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-15-2011 , 13:33   Re: scripting help team divide
Reply With Quote #2

You have to loop through players. Your code is only affecting first player.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-15-2011 , 15:14   Re: scripting help team divide
Reply With Quote #3

Code:
for(new squad, player, i = 0; i < playerCount; i++)
{
    player = Players[i];
    squad = random_num(0, 1);

    entity_set_int(player, EV_INT_skin, squad)
    color_view(player)

    ColorChat(player, RED, "[JailBreak]^x04 You are now part of^x03 squad %d", (squad + 1))
}
And remove "i" variable from the external creation
__________________

Last edited by Hunter-Digital; 07-16-2011 at 10:26.
Hunter-Digital 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 00:57.


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