This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

scripting help team divide


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-29-2011 , 13:28   Re: scripting help team divide
Reply With Quote #21

Quote:
Originally Posted by r0ck View Post
Hunter-Digital thanks but one more request sometimes get_players doesnt works resulting to restart the server map restart also fails and i have searched a lot and they also say that get_players has bugs so can you do something and change get_players to something else ?

Thanks
The problem is not with get_players(). Show your full code.
__________________
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-29-2011 , 13:39   Re: scripting help team divide
Reply With Quote #22

Quote:
Originally Posted by Exolent[jNr] View Post
The problem is not with get_players(). Show your full code.
its with get_players because i have tried that code separately because i also thought that its problem with my full code but fail, get_players when Match with passed team shows bugs sometimes (very less but had to restart server )

final code :-
PHP Code:
public team_up(id
{

    if (
cs_get_user_team(id) == CS_TEAM_CT && is_user_alive(id))
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
        new 
playerCount
        
new Players[32
            
        
get_players(PlayersplayerCount"ae""TERRORIST"
        
        new 
iExtraPlayers playerCount 2
        
        
if (iExtraPlayers
        {
            
ColorChat(idRED"%s Cannot Divide^x04 the Team^x01 due to odd number of^x03 Terrorists"PREFIX)
        }
        else if(
g_teamdivide == true)
        {
            
ColorChat(idRED"%s Team has already been^x04 Divided"PREFIX)
        }
        else
        {
            for(new 
maxPerSquad = (playerCount 2), squads[2], squadplayer0playerCounti++)
            {
                
player Players[i]
                
squad random_num(01)

                if(
squads[squad] >= maxPerSquad)
                    
squad = !squad
                
else
                    
squads[squad]++

                
entity_set_int(playerEV_INT_skinsquad 5)
                
color_view(player
                                
            }
            
ColorChat(0RED"%s^x04 %s^x01 has Divided^x03 Prisoners^x01 into two Teams"PREFIXszName)
            
g_teamdivide true
        
}
    }

__________________
Preparing to release my plugins..
r0ck is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-29-2011 , 13:42   Re: scripting help team divide
Reply With Quote #23

http://www.amxmodx.org/funcwiki.php?go=func&id=174

read last lines

Quote:
Note: "e" flag can return incorrect results (for cstrike/czero at least) when not used with the "a" flag. This is because when players change team, get_players() and get_user_team() will return their old team until they spawn again.

"We don't really support get_players() with flags anymore. It was a bad idea and if it was our choice, it would have never been added to the original AMX Mod." - BAILOPAN
Though its written ae doesnt bugs but it does i have search and many have written that it does bug so ...
__________________
Preparing to release my plugins..

Last edited by r0ck; 07-29-2011 at 13:52.
r0ck is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-29-2011 , 14:13   Re: scripting help team divide
Reply With Quote #24

I have never had problems with get_players, using flags or not. I never use "e" on its own, only "ae", and it works fine.

If you are getting bugs with ae, it's probably something wrong with your code.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-29-2011 , 15:05   Re: scripting help team divide
Reply With Quote #25

If you say you have problems with get_players() just do a for() loop and check team, that'll surely work.

I for one never used get_players() just because of that note quoted above, I like to know that my code will work
__________________
Hunter-Digital is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-29-2011 , 16:05   Re: scripting help team divide
Reply With Quote #26

I swear I've said this at least 10 times.

When a player switches teams while alive, the player's team index (team = get_user_team()) is not updated until next spawn (or maybe next round).
However, the player's team name (get_user_team(.., team_name, charsmax(team_name))) is automatically updated when switching teams.
get_players() checks by team index rather than team name, so it can only give false results when getting players that include dead players and you are checking team-specific players.
If you plan on getting players that way (including dead for team-specific) then it would be better to get dead players and check cs_get_user_team() in the loop.

I wish people would stop spreading "get_players() doesn't work/is bugged/no longer supported" when it still works perfectly fine except for this one situation, or at least tell what I said when they say it is bugged sometimes.
In the way get_players() is used in this thread, there is no bug from the function.
Therefore, it is your code that has issues, not that function.
__________________
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-29-2011 , 23:40   Re: scripting help team divide
Reply With Quote #27

let me tell you the bug ..

get_players works fine most of the time but when it starts showing bug , it never stops till i restart the server (map restart also doesnt works)

bug :- when i say the command team_up whether there are odd or even number of terrorists it always executes he last line which is :- and nothing happens it always shows this then till restarting server and as i told earlier that i have tried this little part separately to check whether my full code has bugs and this part is only bugged
Quote:
ColorChat(0, RED, "%s^x04 %s^x01 has Divided^x03 Prisoners^x01 into two Teams", PREFIX, szName)
g_teamdivide = true
__________________
Preparing to release my plugins..
r0ck is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-30-2011 , 00:35   Re: scripting help team divide
Reply With Quote #28

Quote:
Originally Posted by Exolent[jNr] View Post
I swear I've said this at least 10 times.

When a player switches teams while alive, the player's team index (team = get_user_team()) is not updated until next spawn (or maybe next round).
However, the player's team name (get_user_team(.., team_name, charsmax(team_name))) is automatically updated when switching teams.
get_players() checks by team index rather than team name, so it can only give false results when getting players that include dead players and you are checking team-specific players.
If you plan on getting players that way (including dead for team-specific) then it would be better to get dead players and check cs_get_user_team() in the loop.

I wish people would stop spreading "get_players() doesn't work/is bugged/no longer supported" when it still works perfectly fine except for this one situation, or at least tell what I said when they say it is bugged sometimes.
In the way get_players() is used in this thread, there is no bug from the function.
Therefore, it is your code that has issues, not that function.
Has anybody pushed a bug fix for get_players to check by team-name rather than team-index?
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-30-2011 , 03:17   Re: scripting help team divide
Reply With Quote #29

You should check for "g_teamdivide" before everything else in that function.

And I don't really understand what you're saying... for starters, learn to use commas.
__________________
Hunter-Digital is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-30-2011 , 04:59   Re: scripting help team divide
Reply With Quote #30

Quote:
Originally Posted by nikhilgupta345 View Post
Has anybody pushed a bug fix for get_players to check by team-name rather than team-index?
Arkshine submitted the diff fo fix it. Afaik, it just needs pushed into the dev version.

https://bugs.alliedmods.net/show_bug.cgi?id=4656
__________________
fysiks 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 02:02.


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