Help me with crash - OnPlayerUpdate
#1

Hey guy, i have problems with me server, it is randomly crashing me gamemode
this code when use crashdetect
Quote:

[21:32:30] [debug] #0 00000008 in public OnPlayerUpdate () from vnpla.amx
[21:32:30] [debug] Run time error 8: "Heap underflow"
[21:32:30] [debug] Heap pointer (HEA) is 0x11, heap bottom (HLW) is 0x118BE50
[21:32:30] [debug] AMX backtrace:
[21:32:30] [debug] #0 00000008 in public OnPlayerClickPlayer () from vnpla.amx
[21:32:30] [debug] Run time error 8: "Heap underflow"
[21:32:30] [debug] Heap pointer (HEA) is 0x11, heap bottom (HLW) is 0x118BE50

Help me
code in pawno
Код:
public OnPlayerUpdate(playerid)
{
	// Do not put heavy cpu checks in here. Use the 1 second timer.
	if(playerTabbed[playerid] >= 1)
	{
		playerTabbed[playerid] = 0;
	}
	playerSeconds[playerid] = gettime();

	new pCurWeap = GetPlayerWeapon(playerid);
    if(pCurWeap != pCurrentWeapon{playerid})
    {
        OnPlayerChangeWeapon(playerid, pCurWeap);
        pCurrentWeapon{playerid} = pCurWeap;
    }

    if(acstruct[playerid][checkmaptp] == 1) //blah
	{
	    new Float:dis = GetPlayerDistanceFromPoint(playerid, acstruct[playerid][maptp][0], acstruct[playerid][maptp][1], acstruct[playerid][maptp][2]);
	    if(dis < 5.0)
	    {
			new Float:disd = GetPlayerDistanceFromPoint(playerid, acstruct[playerid][LastOnFootPosition][0], acstruct[playerid][LastOnFootPosition][1], acstruct[playerid][LastOnFootPosition][2]);
			if(disd > 25.0)
			{
		        new srelay[256], Float:X, Float:Y, Float:Z;
		        GetPlayerPos(playerid, X, Y, Z);
				format(srelay, sizeof(srelay), "[mapteleport] %s %d (%0.2f, %0.2f, %0.2f -> %0.2f, %0.2f, %0.2f [%0.2f, %0.2f, %0.2f]) (%f, %f) (%d) (%d)", GetPlayerNameExt(playerid), playerid, \
				acstruct[playerid][LastOnFootPosition][0], acstruct[playerid][LastOnFootPosition][1], acstruct[playerid][LastOnFootPosition][2], \
				X, Y, Z, acstruct[playerid][maptp][0], acstruct[playerid][maptp][1], acstruct[playerid][maptp][2], \
				disd, dis, GetPlayerState(playerid), (GetTickCount()-acstruct[playerid][maptplastclick]));
				Log("logs/hack.log", srelay);

	            format( srelay, sizeof( srelay ), "{AA3333}He thong{FFFF00}: %s da bi banned, ly do: Hack dich chuyen", GetPlayerNameExt(playerid));
				ABroadCast( COLOR_LIGHTRED, srelay, 2 );
				SendClientMessage(playerid, COLOR_LIGHTRED, srelay );
				PlayerInfo[playerid][pBanned] = 3;
				new playerip[32];
				GetPlayerIp(playerid, playerip, sizeof(playerip));
				format( srelay, sizeof( srelay ), "%s (IP:%s) da bi banned, ly do: Hack dich chuyen", GetPlayerNameExt(playerid), playerip);
				PlayerInfo[playerid][pBanned] = 3;
				Log("logs/ban.log", srelay);
				AddBan(playerip);
				Kick(playerid);
				//MySQLBan(GetPlayerSQLId(playerid),playerip,"Hack dich chuyen",-1);
				TotalAutoBan++;
			}
		}
	    acstruct[playerid][checkmaptp] = 0;
	}
	GetPlayerPos(playerid, acstruct[playerid][LastOnFootPosition][0], acstruct[playerid][LastOnFootPosition][1], acstruct[playerid][LastOnFootPosition][2]);

    if(control[playerid] == 1)
	{
	   	new Keys,ud,lr;
	   	GetPlayerKeys(playerid,Keys,ud,lr);

		if(ud > 0)
		{
			if(canmove == 1) return 1;
	    	else canmove = 1;

			new distance = controldistance[playerid];
		    new speed = controlspeed[playerid];

		    new Float:XA[17], Float:YA[17], Float:ZA[17];
		    new Float:XB[14], Float:YB[14], Float:ZB[14];
		    new Float:XC[3], Float:YC[3], Float:ZC[3];

			for(new x;x<sizeof(Carrier);x++)
			{
			    GetDynamicObjectPos(Carrier[x], XA[x], YA[x], ZA[x]);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
			    GetDynamicObjectPos(CarrierS[x], XB[x], YB[x], ZB[x]);
			}

			GetDynamicObjectPos(sidelift, XC[0], YC[0], ZC[0]);
			GetDynamicObjectPos(backhatch, XC[1], YC[1], ZC[1]);
			GetDynamicObjectPos(backlift, XC[2], YC[2], ZC[2]);

			for(new x;x<sizeof(Carrier);x++)
			{
   				MoveDynamicObject(Carrier[x], XA[x]-distance, YA[x], ZA[x], speed);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
				MoveDynamicObject(CarrierS[x], XB[x]-distance, YB[x], ZB[x], speed);
			}

			MoveDynamicObject(sidelift, XC[0]-distance, YC[0], ZC[0], speed);
			MoveDynamicObject(backhatch, XC[1]-distance, YC[1], ZC[1], speed);
			MoveDynamicObject(backlift, XC[2]-distance, YC[2], ZC[2], speed);
		}
	    else if(ud < 0)
		{
		    if(canmove == 1) return 1;
		    else canmove = 1;

			new distance = controldistance[playerid];
		    new speed = controlspeed[playerid];

		    new Float:XA[17], Float:YA[17], Float:ZA[17];
		    new Float:XB[14], Float:YB[14], Float:ZB[14];
	    	new Float:XC[3], Float:YC[3], Float:ZC[3];

			for(new x;x<sizeof(Carrier);x++)
			{
			    GetDynamicObjectPos(Carrier[x], XA[x], YA[x], ZA[x]);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
			    GetDynamicObjectPos(CarrierS[x], XB[x], YB[x], ZB[x]);
			}

			GetDynamicObjectPos(sidelift, XC[0], YC[0], ZC[0]);
			GetDynamicObjectPos(backhatch, XC[1], YC[1], ZC[1]);
			GetDynamicObjectPos(backlift, XC[2], YC[2], ZC[2]);

			for(new x;x<sizeof(Carrier);x++)
			{
   				MoveDynamicObject(Carrier[x], XA[x]+distance, YA[x], ZA[x], speed);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
				MoveDynamicObject(CarrierS[x], XB[x]+distance, YB[x], ZB[x], speed);
			}

			MoveDynamicObject(sidelift, XC[0]+distance, YC[0], ZC[0], speed);
			MoveDynamicObject(backhatch, XC[1]+distance, YC[1], ZC[1], speed);
			MoveDynamicObject(backlift, XC[2]+distance, YC[2], ZC[2], speed);
		}

		if(lr > 0)
		{
  			if(canmove == 1) return 1;
		   	else canmove = 1;

		    new distance = controldistance[playerid];
		    new speed = controlspeed[playerid];

	   	 	new Float:XA[17], Float:YA[17], Float:ZA[17];
		    new Float:XB[14], Float:YB[14], Float:ZB[14];
		    new Float:XC[3], Float:YC[3], Float:ZC[3];

			for(new x;x<sizeof(Carrier);x++)
			{
			    GetDynamicObjectPos(Carrier[x], XA[x], YA[x], ZA[x]);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
			    GetDynamicObjectPos(CarrierS[x], XB[x], YB[x], ZB[x]);
			}

			GetDynamicObjectPos(sidelift, XC[0], YC[0], ZC[0]);
			GetDynamicObjectPos(backhatch, XC[1], YC[1], ZC[1]);
			GetDynamicObjectPos(backlift, XC[2], YC[2], ZC[2]);

			for(new x;x<sizeof(Carrier);x++)
			{
   				MoveDynamicObject(Carrier[x], XA[x], YA[x]-distance, ZA[x], speed);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
				MoveDynamicObject(CarrierS[x], XB[x], YB[x]-distance, ZB[x], speed);
			}

			MoveDynamicObject(sidelift, XC[0], YC[0]-distance, ZC[0], speed);
			MoveDynamicObject(backhatch, XC[1], YC[1]-distance, ZC[1], speed);
			MoveDynamicObject(backlift, XC[2], YC[2]-distance, ZC[2], speed);
		}
  		else if(lr < 0)
		{
  			if(canmove == 1) return 1;
  			else canmove = 1;

			new distance = controldistance[playerid];
		   	new speed = controlspeed[playerid];

		   	new Float:XA[17], Float:YA[17], Float:ZA[17];
		    new Float:XB[14], Float:YB[14], Float:ZB[14];
			new Float:XC[3], Float:YC[3], Float:ZC[3];

			for(new x;x<sizeof(Carrier);x++)
			{
			    GetDynamicObjectPos(Carrier[x], XA[x], YA[x], ZA[x]);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
			    GetDynamicObjectPos(CarrierS[x], XB[x], YB[x], ZB[x]);
			}

			GetDynamicObjectPos(sidelift, XC[0], YC[0], ZC[0]);
			GetDynamicObjectPos(backhatch, XC[1], YC[1], ZC[1]);
			GetDynamicObjectPos(backlift, XC[2], YC[2], ZC[2]);

			for(new x;x<sizeof(Carrier);x++)
			{
   				MoveDynamicObject(Carrier[x], XA[x], YA[x]+distance, ZA[x], speed);
			}
			for(new x;x<sizeof(CarrierS);x++)
			{
				MoveDynamicObject(CarrierS[x], XB[x], YB[x]+distance, ZB[x], speed);
			}

			MoveDynamicObject(sidelift, XC[0], YC[0]+distance, ZC[0], speed);
			MoveDynamicObject(backhatch, XC[1], YC[1]+distance, ZC[1], speed);
			MoveDynamicObject(backlift, XC[2], YC[2]+distance, ZC[2], speed);
		}
	}
	return 1;
}
Reply
#2

i think its color problems
Reply
#3

There is no #0 00000008 color! Look up in your script and change it.
Reply
#4

how to fix?
Reply
#5

How come no one I see here on the forums get the lines of the crashdetect errors? I always get a ":LINE_NUMBER" at the end of errors. Is this because I compile with -d3? In that case, I recommend doing so, so you can check which pieces of your code is specifically giving you these errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)