Raised This Month: $ Target: $400
 0% 

Random Players Selection crashing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 11-07-2011 , 06:56   Random Players Selection crashing
Reply With Quote #1

this code is crashing on (round end) when players are 20+ in ct team ..
tested the mod on 20 slot server works perfectly without crash for hours but on 32 it crashes..... like i said people in ct are 20+ .
it crashes without any logs on round end.

i took help from this topic Random Selection tutorial by Exolent
first i tried the first one without array but it crashed when 15+ then i tried the 2nd one...

my round end code :- [cant show whole due to pvt but problem with random selection only]
PHP Code:
public RoundEndEvent()
{
    
gp_TNextRound 0
    
new total, Array:players ArrayCreate(132)
    
    for(new 
1<= g_iMaxPlayersn++)
    {
        if(
is_user_connected(n) && cs_get_user_team(n) == CS_TEAM_CT)
        {
            if(
g_TNextPlayer[n])
            {
                
gp_TNextRound++
            }
            else
            {
                
ArrayPushCell(playersn)
                
total++
            }
        }
    }
            
    new 
g_TAmount = (TAllowed() - gp_TNextRound)
    
    if(
g_TAmount 0)
    {
        new 
countplayerrand
        
do
        {
            
rand random(total)
            
player ArrayGetCell(playersrand)
            
g_TNextPlayer[player] = true
            count
++
            
ArrayDeleteItem(playersrand)
            
total--
        }
        while(
count g_TAmount)
    }

__________________
Preparing to release my plugins..
r0ck is offline
 


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 14:20.


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