Unkown Command - Backtraces
#1

I have been getting spammed by this in my server logs:

Код:
[15:45:38] [debug]   Stack index (STK) is 0x10CBBD0, stack top (STP) is 0x10CBBCC
[15:45:38] [debug] Backtrace (most recent call first):
[15:45:38] [debug] #0  00000008 in Clock () from rc.amx
[15:45:39] [debug] Run time error 7: "Stack underflow"
What happens is that once i use a command for example, /refund, it will send me "Server: Unknown Command" , Until or unless i do it for like 3 -4 times then it will work, So any fix for this?

Regards,
UnknownOwner
Reply
#2

Compile in the debug mode.

You are accesing an array in a negative index. (for example -1: Array[ -1 ])
Reply
#3

Can't find that. Check my OnPlayerUpdate (if needed) or any other code:
Код:
public OnPlayerUpdate(playerid)
{
	UpdateHP(playerid);
	if(IsPlayerConnected(playerid) && IsPlayerLoggedIn(playerid))
	{
	    if(!BoomboxStream[playerid])
	    {
	        for(new i=0; i<MAX_PLAYERS; i++)
	        {
	            if(IsPlayerConnected(i))
	            {
	                if(Boombox[i])
	                {
	                    if(IsPlayerInRangeOfPoint(playerid, 30, bpos[i][0], bpos[i][1], bpos[i][2]))
	                    {
	                        PlayAudioStreamForPlayer(playerid, BoomboxURL[i], bpos[i][0], bpos[i][1], bpos[i][2], 30, 1);
	                        BoomboxPlayer[playerid] = i;
	                        BoomboxStream[playerid] = 1;
	                        SendClientMessage(playerid, COLOR_GREY, " You are listening to music coming out of a nearby boombox.");
	                    }
	                }
	            }
	        }
	    }
	    else
	    {
	        new i = BoomboxPlayer[playerid];
	        if(!IsPlayerInRangeOfPoint(playerid, 30, bpos[i][0], bpos[i][1], bpos[i][2]))
	        {
	            BoomboxStream[playerid] = 0;
	            BoomboxPlayer[playerid] = -1;
	            StopAudioStreamForPlayer(playerid);
	            SendClientMessage(playerid, COLOR_GREY, " You have went far away from the boombox.");
	        }
	    }
	    // Boxing
	    if(Boxing[playerid] && !BoxTime)
	    {
	        new string[128];
	        new Float:bH; GetPlayerHealth(playerid, bH);
	        if(bH <= 20)
	        {
	            // Getting other boxer's ID
				new playerb = -1;
	            foreach(Player, i)
	            {
	                if(Boxing[i] && i != playerid) playerb = i;
	            }
	            if(playerb != -1)
	            {
	                format(string, sizeof(string), "Boxing Ring: The boxing match has ended, %s has won the match.", RPN(playerb));
	        		SendGymMessage(COLOR_WHITE, string);
		            // Putting them out of the ring
		            SetPlayerPos(playerb, 760.9759,4.7187,1000.7084);
		            SetPlayerFacingAngle(playerb, 268.9407);
		            SetPlayerPos(playerid, 760.9759,6.1794,1000.7093);
		            SetPlayerFacingAngle(playerid, 268.9407);
		            // Giving the winner extra skill point
		            new oldj = strval(RPJL(playerb, JOB_BOXER));
		            PlayerInfo[playerb][pJobSkill][JOB_BOXER] ++;
					new newj = strval(RPJL(playerb, JOB_BOXER));
				    if(oldj < newj)
					{
					    format(string, sizeof(string), "** Your Boxer level is now %d, you can now cause %d more damage. **", newj, (newj*2)-2);
						SendClientMessage(playerb, COLOR_YELLOW, string);
					}
					//
					SendClientMessage(playerb, COLOR_LIME, " You have won the boxing match.");
					SendClientMessage(playerid, COLOR_LIGHTRED, " You have lost the boxing match.");
					// Giving Bids
					new winner = pBoxer[playerb];
					foreach(Player, i)
					{
					    if(BidBoxer[i] == winner)
					    {
					        new percent, profit;
					        percent = (BidAmount[i]/BoxerBid[winner]) * 100;
					        profit = (percent * BoxerBid[pBoxer[playerid]]) / 100;
					        GiveZaiatMoney(i, BidAmount[i] + profit);
					        format(string, sizeof(string), " You have won $%d from bidding in the match, the money you bid has been returned as well.", profit);
					        SendClientMessage(i, COLOR_LIME, string);
					    }
						BidAmount[i] = 0;
						BidBoxer[i] = 0;
					}
					for(new w = 0; w < 13; w++)
					{
					    GiveZaiatWeapon(playerb, PlayerInfo[playerb][pWeapon][w], PlayerInfo[playerb][pWeaponAmmo][w]);
					}
	            }
	            for(new w = 0; w < 13; w++)
				{
				    GiveZaiatWeapon(playerid, PlayerInfo[playerid][pWeapon][w], PlayerInfo[playerid][pWeaponAmmo][w]);
				}
	            // Resetting Values
				BoxingMatch = 0;
				Boxer[1] = -1;
				pBoxer[playerb] = 0;
				Boxer[2] = -1;
				pBoxer[playerid] = 0;
				Boxing[playerb] = 0;
				Boxing[playerid] = 0;
				BoxerBid[1] = 0;
				BoxerBid[2] = 0;
	        }
	    }
	    // Spikes
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
	        if(!IsACop(playerid) && !IsAFBI(playerid) && !IsAHSF(playerid) && !IsASWAT(playerid) && !IsASATF(playerid))
	  	    {
		        for(new i = 0; i < sizeof(SpikeInfo); i++)
		  	    {
		  	        if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
		            {
		  	            if(SpikeInfo[i][sCreated] == 1)
		  	            {
		  	                new panels, doors, lights, tires;
		  	                new carid = GetPlayerVehicleID(playerid);
				            GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				            tires = encode_tires(1, 1, 1, 1);
				            UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
		  	            }
		  	        }
		  	    }
			}
	  	}
	    // Fuel
	    new vehicleid = GetPlayerVehicleID(playerid);
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Fuel[vehicleid] <= 0)
	    {
	    	new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
			GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
			if(engine)
			{
				SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);
			    if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
			    {SetVehicleParamsEx(vehicleid, 0, 0, 0, PlayerInfo[playerid][vLocked], 0, 0, 0);}
			    if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
			    {SetVehicleParamsEx(vehicleid, 0, 0, 0, PlayerInfo[playerid][vVLocked], 0, 0, 0);}
 			    if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pBVeh])
			    {SetVehicleParamsEx(vehicleid, 0, 0, 0, PlayerInfo[playerid][vBLocked], 0, 0, 0);}
			    format(string, sizeof(string), "* %s's vehicle stops as it has no fuel in its tank.", RPN(playerid));
				SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			}
	    }
	    // Drag
	    if(Dragged[playerid] != -1)
	    {
			new playerb = Dragged[playerid];
			new Float:pos[3];
			GetPlayerPos(playerb, pos[0], pos[1], pos[2]);
			SetPlayerPos(playerid, pos[0]+0.5, pos[1]+0.5, pos[2]);
			SetPlayerInterior(playerid, GetPlayerInterior(playerb));
			SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerb));
	    }
	    // AntiCS
	    new Keys, ud, lr;
		GetPlayerKeys(playerid, Keys, ud, lr);
		if(CheckCrouch[playerid] == 1) {
			switch(WeaponID[playerid]) {
			    case 23..25, 27, 29..34, 41: {
			    	if((Keys & KEY_CROUCH) && !((Keys & KEY_FIRE) || (Keys & KEY_HANDBRAKE)) && GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK ) {
			    		if(Ammo[playerid][GetPlayerWeapon(playerid)] > GetPlayerAmmo(playerid)) {
							OnPlayerCBug(playerid);
						}
			    	}
			    	//else SendClientMessage(playerid, COLOR_RED, "Failed in onplayer update");
			    }
			}
		}

		if(!ud && !lr) { NotMoving[playerid] = 1; /*OnPlayerKeyStateChange(playerid, Keys, 0);*/ }
		else { NotMoving[playerid] = 0; /*OnPlayerKeyStateChange(playerid, Keys, 0);*/ }
	    // Alt-Tab detection
		AltTabbed[playerid] = 0;
		// Speedlimit
		if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Speedlimit[playerid])
		{
		    new a, b, c;
			GetPlayerKeys(playerid, a, b ,c);
		    if(a == 8 && GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) > Speedlimit[playerid])
		    {
		        new newspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) - Speedlimit[playerid];
		    	ModifyVehicleSpeed(GetPlayerVehicleID(playerid), -newspeed);
		    }
		}
	    // Ping Update
	    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
	    {
	        new string[64];
            format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~%s's Ping: ~w~%d", NORPN(Specid[playerid]), GetPlayerPing(Specid[playerid]));
			GameTextForPlayer(playerid, string,1000, 3);
	    }
	    // Money Anticheat
		if(GetPlayerMoney(playerid) != PlayerInfo[playerid][pMoney])
		{
			ResetPlayerMoney(playerid);
			GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
		}
		// Speedometer
		if(Speedo[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
		    new string[64], speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
		    //format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Speedometer: ~w~%d MPH", speed);
		    format(string,sizeof(string),"MPH: %d", speed);
		    TextDrawSetString(speedometer, string);
			//GameTextForPlayer(playerid, string,1000, 3);
		}
		// SpeedCheck
		if(USE_ANTI_SPEEDHACK == true)
		{
			if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PlayerInfo[playerid][pAdmin] < 2)
			{
				new speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
				if(speed > 270 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 519 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 553 || speed > 300)
				{
					new string[128];
					format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s might be using speed hacks (%d MPH)", NORPN(playerid), speed);
					new Float:X, Float:Y, Float:Z;
					GetPlayerPos(playerid, X, Y, Z);
					RemovePlayerFromVehicle(playerid);
					SetPlayerPos(playerid, X, Y, Z+5);
					Log("logs/hack.log", string);
					SendAdminMessage(COLOR_DARKRED, 1, string);
				}
			}
		}
		// Jetpack Hack
		if(USE_ANTI_JETPACK == true)
		{
			if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && JetPack[playerid] == 0 && PlayerInfo[playerid][pAdmin] < 2)
			{
				new string[74 + MAX_PLAYER_NAME];
				format( string, sizeof( string ), "{FF0000}[Admin Warn]{FF6347} %s may possibly be jetpack hacking.", NORPN(playerid));
				new Float:Pos[3];
				GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
				SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]+5);
				Log("logs/hack.log", string);
				SendAdminMessage(COLOR_DARKRED, 1, string);
			}
		}
		// Nask Update
	    if(PlayerInfo[playerid][pMaskOn] == 1)
			{
		    	for(new i; i<MAX_PLAYERS; i++)
			    {
		  	  		if(IsPlayerConnected(i))
		   	   		{
			    		ShowPlayerNameTagForPlayer(i, playerid, 0);
			    	}
	  		  }
	 	 }
		if(PlayerInfo[playerid][pMaskOn] == 0)
	{
	//PlayerInfo[playerid][pMask] = 0;
	    for(new i; i<MAX_PLAYERS; i++) {
	        if(IsPlayerConnected(i)) {
	            ShowPlayerNameTagForPlayer(i, playerid, 1);
	        }
	    }
	}
		// Fuel
		if(fMeter[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
		    new string[64];
		    //format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Fuel: ~w~%d%", Fuel[GetPlayerVehicleID(playerid)]);
			//GameTextForPlayer(playerid, string,1000, 3);
   			format(string,sizeof(string),"Fuel: %d%", Fuel[GetPlayerVehicleID(playerid)]);
		    TextDrawSetString(fuelmeter, string);
		}
	}
	return 1;
}
Reply
#4

If you compile with debug flag (-d3) you'll get the exact error and callback where the problem is at.
Reply
#5

As i am kinda new, how to use debug flag?
Reply
#6

Quote:
Originally Posted by UnknownOwner
Посмотреть сообщение
As i am kinda new, how to use debug flag?
Create a pawn.cfg file in the PAWNO folder and write -d3 into it.
Reply
#7

Tried that, get this now: (No errors)

Код:
Header size:          25800 bytes
Code size:          2930452 bytes
Data size:         17595344 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:20567980 bytes
The script runs fine on my PC, but sscanf won't work on my host. Its not the host problem, cuz it is happening with all the hosts i use...
Reply
#8

Any help guys?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)