I found the error at last sorry ....
The problem was models (cs_set_user_model crashing )
But with this code for random selection it sometimes show error......
Error Sometimes ( different values at different times) and it doesn't shuffle
and sometimes it shuffles without error
Quote:
Invalid cellvector handle provided (26:12:12) <----------------shows different values in log file
Displaying debug trace (plugin "TestPlugin2.amxx")
Run time error 10: native error (native "ArrayGetCell")
TestPlugin2.sma::LogEvent_RoundEnd (line 536)
|
Code
Code:
public LogEvent_RoundEnd()
{
g_TNextPlayerNo= 0
new total, Array:players = ArrayCreate(1, 32)
for(new n = 1; n <= g_iMaxPlayers; n++)
{
if(is_user_connected(n))
{
switch(cs_get_user_team(n))
{
case CS_TEAM_T: g_FirstSpawn[n] = true
case CS_TEAM_CT:
{
g_FirstSpawn[n] = true
if(g_TNextPlayer[n])
{
g_TNextPlayerNo++
}
else
{
ArrayPushCell(players, n)
total++
}
}
}
}
}
new TAmount = (TAllowed() - g_TNextPlayerNo)
if(TAmount > 1)
{
new count, player, rand
do
{
rand = random(total)
player = ArrayGetCell(players, rand) <--------- line 536
g_TNextPlayer[player] = true
count++
ArrayDeleteItem(players, rand)
total--
}
while(count < TAmount && total > 1)
}
}
__________________