Run time error 7: "Stack underflow"? -
vvhy - 19.06.2012
I am using a plugin crashdetect and here are one of the errors I am getting:
Note* this is only one of the errors just like this I am getting about different functions on the script
Code:
[15:02:18] [debug] Stack index (STK) is 0xAC6240, stack top (STP) is 0xAC6238
[15:02:18] [debug] Run time error 7: "Stack underflow"
[15:02:18] [debug] #0 00000008 in ArmyGates () from Gammode.amx
[15:02:18] [debug] Backtrace (most recent call first):
and here is ArmyGates
pawn Code:
public ArmyGates()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(10.0, i, -1530.15380859,482.34051514,8.83757210) && ArmyGate == 0)
{
if(gTeam[i] == TEAM_ARMY)
{
MoveObject(ArmyGate, -1540.15380859,482.34051514,8.83757210, 5);
ArmyGate =1;
SetTimer("ArmyGatesClose",7000,0);
}
}
}
}
Re: Run time error 7: "Stack underflow"? -
Faisal_khan - 19.06.2012
Explain this line why do you need this:
pawn Code:
if(PlayerToPoint(10.0, i, -1530.15380859,482.34051514,8.83757210) && ArmyGate == 0)
I mean the ArmyGate == 0 part. Try removing it. If problem still persists, paste your ArmyGate define.
Wish you luck!
Re: Run time error 7: "Stack underflow"? - HuSs3n - 19.06.2012
you should add IsPlayerConnected condition in your loop
also replace PlayerToPoint with IsPlayerInRangeOfPoint
Re: Run time error 7: "Stack underflow"? -
vvhy - 19.06.2012
@Faisal_khan
I don't think player to point is the problem because none of the other errors I am getting have that, the only thing in common they all have is
Quote:
for(new i=0; i<MAX_PLAYERS; i++)
|
@HuSs3n I don't think IsPlayerConnected would be the problem because I also tried ******'s foreach and I think it has IsPlayerConnected included with it.
@****** I did not get any errors or warnings upon compilation.
Re: Run time error 7: "Stack underflow"? -
niels44 - 19.06.2012
mate, you forgot a return? try this:
pawn Code:
public ArmyGates()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(10.0, i, -1530.15380859,482.34051514,8.83757210) && ArmyGate == 0)
{
if(gTeam[i] == TEAM_ARMY)
{
MoveObject(ArmyGate, -1540.15380859,482.34051514,8.83757210, 5);
ArmyGate =1;
SetTimer("ArmyGatesClose",7000,0);
}
}
}
return 1;
}
i always have to use returns at end of public callback
Re: Run time error 7: "Stack underflow"? -
vvhy - 19.06.2012
I am using it as a timer so it doesn't need a return I don't think, but also the issue I am having is Stack underflow and it has it in several places in my script this was just the shortest of them so I could easily post it on the forums.
Re: Run time error 7: "Stack underflow"? -
Babul - 19.06.2012
pawn Code:
SetTimer("ArmyGatesClose",7000,0);
inside a loop? bad idea, idk if its relevant here, since just 1 player will triger that timer.. but what happens, if there is another player (same team) close? i bet the timer will get set twice, and only 1 returns?
Re: Run time error 7: "Stack underflow"? - HuSs3n - 19.06.2012
you have to use this
https://sampforum.blast.hk/showthread.php?tid=249897
to get more information from your crashdetect plugin and know in which line exactly the error occours