12.03.2013, 12:18
(
Last edited by nGen.SoNNy; 12/03/2013 at 12:51 PM.
)
Hi guys! I have some problems on my Spectate Script and idk what crashdebug want to tell me about it xD
Somebody who can tell me what this means? I can provide the script here if somebody is interested...
Somebody who can tell me what this means? I can provide the script here if somebody is interested...
Code:
[15:12:00] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)" [15:12:00] [debug] Stack pointer (STK) is 0x1A98F0, heap pointer (HEA) is 0x1A98B4 [15:12:00] [debug] AMX backtrace: [15:12:00] [debug] #0 000a3128 in public ConnectedPlayers () at C:\Users\SoNNy\Desktop\0 Stunt Evo 0\gamemodes\(SE-B).pwn:14503 [15:12:00] [debug] #1 000b22ac in AdvanceSpectate (playerid=0) at C:\Users\SoNNy\Desktop\0 Stunt Evo 0\gamemodes\(SE-B).pwn:15728 [15:12:00] [debug] #2 000b1c28 in StartSpectate (playerid=0, specplayerid=1) at C:\Users\SoNNy\Desktop\0 Stunt Evo 0\gamemodes\(SE-B).pwn:15686
pawn Code:
function ConnectedPlayers( )
{
new
Connected
;
foreach(Player, i )
Connected++;
return Connected;
}
stock AdvanceSpectate( playerid )
{
if ( ConnectedPlayers( ) == 2 )
{
StopSpectate( playerid );
return ( 1 );
}
if ( GetPlayerState( playerid ) == PLAYER_STATE_SPECTATING && PlayerInfo[ playerid ][ SpecID ] != INVALID_PLAYER_ID )
{
for ( new x = PlayerInfo[ playerid ][ SpecID ]+1; x <= MAX_PLAYERS; x++ )
{
if ( x == MAX_PLAYERS )
x = 0;
if ( IsPlayerConnected( x ) && x != playerid )
{
if ( GetPlayerState( x ) == PLAYER_STATE_SPECTATING && PlayerInfo[ x ][ SpecID ] != INVALID_PLAYER_ID || ( GetPlayerState( x ) != 1 && GetPlayerState( x ) != 2 && GetPlayerState( x ) != 3 ) )
continue;
else
{
StartSpectate( playerid, x );
break;
}
}
}
}
return ( 1 );
}
stock StartSpectate( playerid, specplayerid )
{
foreach(Player, x )
if ( GetPlayerState( x ) == PLAYER_STATE_SPECTATING && PlayerInfo[ x ][ SpecID ] == playerid )
AdvanceSpectate( x );
SetPlayerInterior( playerid, GetPlayerInterior( specplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( specplayerid ) );
TogglePlayerSpectating( playerid, 1 );
if ( IsPlayerInAnyVehicle( specplayerid ) )
{
PlayerSpectateVehicle( playerid, GetPlayerVehicleID( specplayerid ) );
PlayerInfo[ playerid ][ SpecID ] = specplayerid;
PlayerInfo[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_VEHICLE;
}
else
{
PlayerSpectatePlayer( playerid, specplayerid );
PlayerInfo[ playerid ][ SpecID ] = specplayerid;
PlayerInfo[ playerid ][ SpecType ] = ADMIN_SPEC_TYPE_PLAYER;
}
gsString[ 0 ] = EOS;
new
Float:hp,
Float:ar
;
GetPlayerHealth( specplayerid, hp );
GetPlayerArmour( specplayerid, ar );
format( gsString, sizeof( gsString ), "~n~~n~~n~~n~~n~~n~~n~~n~~w~%s - id:%d~n~< sprint - jump >~n~hp:%0.1f ar:%0.1f $%d", PlayerName( specplayerid ), specplayerid, hp, ar, GetPlayerMoney( specplayerid ) );
Announce( playerid, gsString, 25000, 3 );
return ( 1 );
}