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 , 01:47   scripting help team divide
Reply With Quote #1

i wanted to know how can we divide a team say terrorists to two groups ? like half of terrorist's model be terror and half be guerilla ? like if admins say /team_up ? dont need full plugin just that part of script if number are odd then error like teams cannot be made due to odd number of terrorists

thanks
r0ck is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-15-2011 , 03:59   Re: scripting help team divide
Reply With Quote #2

Code:
new iPlayers = 11
new iExtraPlayers = iPlayers % 2

if(iExtraPlayers)
{
    // players can't be equally divided
}
else
{
    // players can be divided
}
__________________
Hunter-Digital is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-15-2011 , 08:05   Re: scripting help team divide
Reply With Quote #3

can you explain a bit more ?
r0ck is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-15-2011 , 09:13   Re: scripting help team divide
Reply With Quote #4

You said:
Quote:
Originally Posted by r0ck View Post
dont need full plugin just that part of script if number are odd then error like teams cannot be made due to odd number of terrorists
And that code does that, asign "iPlayers" as the number of terrorists or whatever you need and the "iExtraPlayers" would be 0 if the number of terrorists can be divided by 2.
In the example code it can't be divided, so "iExtraPlayers" is 1.
__________________
Hunter-Digital is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-15-2011 , 13:07   Re: scripting help team divide
Reply With Quote #5

what am i doing wrong i want that even number of t's divide and 1 groups entity should have entity_set_int(Players[i], EV_INT_skin, random_num, 0) and other group entity_set_int(Players[i], EV_INT_skin, random_num, 1)

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:18   Re: scripting help team divide
Reply With Quote #6

Quote:
Originally Posted by r0ck View Post
PHP Code:
        new iExtraPlayers playerCount 2
        
        get_players
(PlayersplayerCount"ae""TERRORIST"
what am i doing wrong
You are checking player count before you get players.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-15-2011 , 13:31   Re: scripting help team divide
Reply With Quote #7

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 #8

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 #9

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
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-16-2011 , 00:08   Re: scripting help team divide
Reply With Quote #10

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
        {
            for(new 
squadplayer0playerCounti++)
            {
                
player Players[i];
                
squad random_num(01);

                
entity_set_int(playerEV_INT_skinsquad)
                
color_view(player)

                
ColorChat(0RED"[JailBreak]^x04 %s Divided^x03 The team^x04",id)
            }    
        }
    }

Thanks its working
r0ck 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