Sziasztok!
A fallout scriptembe van egy eljárás, ami ha meghívodik, ledobja(elvesz az object magassági pozíciójából) az objectet, és ha az összes object lent van, és még nem ért véget a menet, akkor döntetlent nyílvánít. Amikor ez lezajlik, akkor kifagy a szerver.
Itt a kód:
public FalloutDropObjects( )
{
if( GetGVarInt( \"FalloutStarted\" ) == 1 )
{
if( AllFalloutObjectsDropped( ) )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Minigame\" ) == 2 )
{
SetPVarInt( i, \"Minigame\", 0 );
SpawnPlayer( i );
TogglePlayerControllable( i, 1 );
}
}
SetGVarInt( \"FalloutPlayers\", 0 );
SetGVarInt( \"FalloutActive\", 0 );
SetGVarInt( \"FalloutStarted\", 0 );
for( new iObjects; iObjects < sizeof( iFalloutObjects ); iObjects++ )
{
FalloutObjectsDropped[ iObjects ] = false;
}
for( new iPos; iPos < 13; iPos++ )
{
FalloutPositionUsed[ iPos ] = false;
}
FalloutMapUnload( );
FalloutMapLoad( );
SendClientMessageToAll( COLOR_RED, \"Fallout: A Fallout minijátékot senki nem nyerte meg, döntetlen az eredmény.\" );
return 1;
}
RandomGotoDrop:
{
new
iRandObj = random( 36 );
if( FalloutObjectsDropped[ iRandObj ] == true )
{
goto RandomGotoDrop;
}
new
Float: fObjectPos[ 3 ];
GetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] );
SetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] - 170 );
FalloutObjectsDropped[ iRandObj ] = true;
}
}
return 1;
}
Ezt írja a crashdetect:
[19:48:15] [debug] Run time error 4: \"Array index out of bounds\"
[19:48:15] [debug] Accessing element at index 36 past array upper bound 35
[19:48:15] [debug] AMX backtrace:
[19:48:15] [debug] #0 00055368 in ?? () from gm.amx
[19:48:15] [debug] #1 0002dbec in public FalloutDropObjects () from gm.amx
Esetleg így?
public FalloutDropObjects( )
{
if( GetGVarInt( \"FalloutStarted\" ) == 1 )
{
if( AllFalloutObjectsDropped( ) )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Minigame\" ) == 2 )
{
SetPVarInt( i, \"Minigame\", 0 );
SpawnPlayer( i );
TogglePlayerControllable( i, 1 );
}
}
SetGVarInt( \"FalloutPlayers\", 0 );
SetGVarInt( \"FalloutActive\", 0 );
SetGVarInt( \"FalloutStarted\", 0 );
for( new iObjects; iObjects < sizeof( iFalloutObjects ); iObjects++ )
{
FalloutObjectsDropped[ iObjects ] = false;
}
for( new iPos; iPos < 13; iPos++ )
{
FalloutPositionUsed[ iPos ] = false;
}
FalloutMapUnload( );
FalloutMapLoad( );
SendClientMessageToAll( COLOR_RED, \"Fallout: A Fallout minijátékot senki nem nyerte meg, döntetlen az eredmény.\" );
}
RandomGotoDrop:
{
new
iRandObj = random( 35 );
if( FalloutObjectsDropped[ iRandObj ] == true )
{
goto RandomGotoDrop;
}
new
Float: fObjectPos[ 3 ];
GetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] );
SetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] - 170 );
FalloutObjectsDropped[ iRandObj ] = true;
}
}
return 1;
}
Ha nem jó, akkor másold be hogy hozod létre a FalloutObjectsDropped változót
Esetleg így?
public FalloutDropObjects( )
{
if( GetGVarInt( \"FalloutStarted\" ) == 1 )
{
if( AllFalloutObjectsDropped( ) )
{
foreach(Player, i)
{
if( GetPVarInt( i, \"Minigame\" ) == 2 )
{
SetPVarInt( i, \"Minigame\", 0 );
SpawnPlayer( i );
TogglePlayerControllable( i, 1 );
}
}
SetGVarInt( \"FalloutPlayers\", 0 );
SetGVarInt( \"FalloutActive\", 0 );
SetGVarInt( \"FalloutStarted\", 0 );
for( new iObjects; iObjects < sizeof( iFalloutObjects ); iObjects++ )
{
FalloutObjectsDropped[ iObjects ] = false;
}
for( new iPos; iPos < 13; iPos++ )
{
FalloutPositionUsed[ iPos ] = false;
}
FalloutMapUnload( );
FalloutMapLoad( );
SendClientMessageToAll( COLOR_RED, \"Fallout: A Fallout minijátékot senki nem nyerte meg, döntetlen az eredmény.\" );
}
RandomGotoDrop:
{
new
iRandObj = random( 35 );
if( FalloutObjectsDropped[ iRandObj ] == true )
{
goto RandomGotoDrop;
}
new
Float: fObjectPos[ 3 ];
GetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] );
SetObjectPos( iFalloutObjects[ iRandObj ], fObjectPos[ 0 ], fObjectPos[ 1 ], fObjectPos[ 2 ] - 170 );
FalloutObjectsDropped[ iRandObj ] = true;
}
}
return 1;
}
Ha nem jó, akkor másold be hogy hozod létre a FalloutObjectsDropped változót
De így 0-34-ig fog generálni számokat, és nekem 0-35-ig vannak az objectek, így tehát 1 object nem fog leesni.
FalloutObjectsDropped
ennek a tömbnek mekkora a mérete?
[/quote]
36 cella.
bool: FalloutObjectsDropped[ 36 ]
E.: Idõközben kivettem az AllFalloutObjectDropped() eljárást, mert hibásan írtam meg.