17.05.2016, 14:44
Quote:
Its your recurrsive function that is causing the problem.
Each time a function is called, some information is pushed onto the stack. Your function calls itself so many times that your stack size increases to such an extent that it collides with the heap. The heap and stack share the same memory in your RAM and they run in opposite directions. The problem is that your SpectateNext is an infinite loop. Код:
function SpectateNext(playerid) { new bool:fl; foreach(new i:Player) if(PInfo[i][pInDerby] && i > PInfo[playerid][pSpectateID]) { new tdstring[85]; fl = true; PInfo[playerid][pSpectateID] = i; format(tdstring, sizeof(tdstring), "~<~ ~g~~h~Spectate: ~w~%s ~>~", GetName(PInfo[playerid][pSpectateID])); PlayerTextDrawSetString(playerid, PInfo[playerid][pSpectateTD], tdstring); PlayerSpectateVehicle(playerid, GetPlayerVehicleID(i)); break; } if(!fl) { PInfo[playerid][pSpectateID] = -1; SpectateNext(playerid); } return 1; } Код:
i > PInfo[playerid][pSpectateID] Код:
PInfo[playerid][pSpectateID] = -1; Код:
if(!fl) { PInfo[playerid][pSpectateID] = -1; SpectateNext(playerid); } |