Server crashed ONPLAYERTEXT (+rep)
#1

Код HTML:
[20:05:07] [debug] OnPlayerText(9, I dont think so cause he gave me that infernus for 45kk and i sold it to another one with 75kk$.thats good)
[20:05:07] [debug] Server crashed while executing gm.amx
[20:05:07] [debug] AMX backtrace:
[20:05:07] [debug] #0 00000073 in ?? (... <26 arguments>) at <unknown file>:0
[20:05:07] [debug] #1 00000073 in public OnPlayerText () at <unknown file>:0
Script:


Код:
public OnPlayerText(playerid, text[]) {
	#if defined DEBUG
	    printf("[debug] OnPlayerText(%d, %s)", playerid, text);
	#endif
	assert(AntiFlood_Check(playerid));
	///----- Anti SPAM -----///
	if(text[0] && !strcmp (text, LastText[playerid]) && LastTextTime[playerid] > GetTickCount () && PlayerData[playerid][pAdminLevel] < 1) return 0;
    LastTextTime[playerid] = GetTickCount() + SECONDS_BETWEEN_SAME_MSGS * 1000;
	strcpy(LastText[playerid], text, 128);
 if(FindIP(text) || FindAD(text))
	{
		if(PlayerData[playerid][pMuted] == 0)
		{
		PlayerData[playerid][pMuted] = 5;
		}
		SCM(playerid, COLOR_WHITE,"advertisting");
		format(szMessage, sizeof(szMessage), "%s is possibly server advertisting (%s)", PlayerData[playerid][pNormalName], text);
		submitToHelpersAndAdmins(szMessage, COLOR_LIGHTRED);
		return 0;
	}
	if(TalkingLive[playerid] != 255)
	{
	    new string[128];
	   	new sendername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if(PlayerData[playerid][pGroup] == 15)
		{
		    format(string, sizeof(string), "Reporter %s: %s", sendername, text);
			OOCNews(COLOR_LIGHTGREEN, string);
		}
		else
		{
		    format(string, sizeof(string), "LivePlayer %s: %s", sendername, text);
			OOCNews(COLOR_LIGHTGREEN, string);
		}
		return 0;
	}
	if(PlayerData[playerid][pStatus] >= 1 && PlayerData[playerid][pMuted] == 0)
	{
		GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
		for(new i = 0; i < strlen(szPlayerName); i++)
		{
			if(szPlayerName[i] == '_')
			    szPlayerName[i] = ' ';
		}
		if(Mobile[playerid] != 1000)
		{
		//	format(szMessage, sizeof(szMessage), "(cellphone) \"%s\"", text);
		//	SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 10.0, 10000);
			format(szMessage, sizeof(szMessage), "(cellphone) %s says: %s", szPlayerName, text);
			nearByMessage(playerid, COLOR_WHITE, szMessage);

			switch (Mobile[playerid])
			{
				case 911: {
					if(!strcmp(text, "LSPD", true) || !strcmp(text, "police", true)) {
						SCM(playerid, COLOR_WHITE, "(cellphone) 911: You have reached the Los Santos Police emergency hotline; can you describe the crime?");
						Mobile[playerid] = 912;
					}
					else if(!strcmp(text, "LSFMD", true) || !strcmp(text, "medic", true) || !strcmp(text, "ambulance", true)) {
						SCM(playerid, COLOR_WHITE, "(cellphone) 911: This is the Los Santos Fire & Medic Department emergency hotline; describe the emergency, please.");
						Mobile[playerid] = 914;
					}
					else SCM(playerid, COLOR_WHITE, "(cellphone) 911: Sorry, I didn't quite understand that... speak again?");
				}
				case 912:
				{
					if(strlen(text) > 1)
					{
						new
							location[MAX_ZONE_NAME];
						GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
			            format(szMessage, sizeof(szMessage), "Dispecer: %s reported: '%s' (10-20 %s)", szPlayerName, text, location);
      					SendToGroupType(1, COLOR_RADIOCHAT, szMessage);
      					SendToGroupType(2, COLOR_RADIOCHAT, szMessage);
						SendClientMessage(playerid, COLOR_WHITE, "(cellphone) 911: Thank you for reporting this incident; a patrol unit is now on its way.");

						SendClientMessage(playerid, COLOR_WHITE, "Your call has been terminated by the other party.");

						if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
							SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
						}
						Mobile[playerid] = 1000;
					}
				}
				default:
				{
					if(IsPlayerConnected(Mobile[playerid]))
					{
						new samp[128];
					    if(Mobile[Mobile[playerid]] == playerid)
					    {
							if(PlayerData[Mobile[playerid]][pSpeaker] == 1)
							{
								format(samp, 256, "(speaker) %s: %s",GetName(playerid), text);
								nearByMessage(Mobile[playerid], COLOR_GREY, samp);
							}
							else
							{
								format(samp, 256, "(cellphone) %s: %s",GetName(playerid), text);
							    SendClientMessage(Mobile[playerid], COLOR_GREY, samp);
							}
						}
					}
				}
			}
		}
		else
		{
    			if(PlayerData[playerid][pInPaint] == 0)
				{
				    if(PlayerData[playerid][pColor] == 0)
				    {
				        format(szMessage, sizeof(szMessage), "{FFFFFF}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 1)
				    {
				        format(szMessage, sizeof(szMessage), "{0087FE}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 2)
				    {
				        format(szMessage, sizeof(szMessage), "{EBFF00}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 3)
				    {
				        format(szMessage, sizeof(szMessage), "{1a1a1a}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 4)
				    {
				        format(szMessage, sizeof(szMessage), "{3ee605}%s{FFFFFF}: %s", szPlayerName, text);
				    }
					else if(PlayerData[playerid][pColor] == 5)
				    {
				        format(szMessage, sizeof(szMessage), "{ed2bfa}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 6)
				    {
				        format(szMessage, sizeof(szMessage), "{fb8525}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    else if(PlayerData[playerid][pColor] == 7)
				    {
				        format(szMessage, sizeof(szMessage), "{33CCFF}%s{FFFFFF}: %s", szPlayerName, text);
				    }
				    if(PlayerData[playerid][pHelper] >= 1) format(szMessage, sizeof(szMessage), "{CC3300}%s:{FFFFFF} %s", szPlayerName, text);
				    if(PlayerData[playerid][pAdminLevel] >= 1 ) format(szMessage, sizeof(szMessage), "{669999}%s:{FFFFFF} %s", szPlayerName, text);
				    if(PlayerData[playerid][pMuted] >= 1 ) format(szMessage, sizeof(szMessage), "{666699}%s:{FFFFFF} I am muted for {669999} %d {ffffff}seconds", szPlayerName, PlayerData[playerid][pMuted]);
                    //MESSAGE SPLIT
					new len = strlen(szMessage),
						_iL = len / EX_SPLITLENGTHH;
					if( ( len % EX_SPLITLENGTHH ) ) _iL++;
					new _Line[EX_SPLITLENGTHH+5];
					new _:_i@Index;
					while( _i@Index < _iL )
					{
						if( _i@Index == 0 )
							strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );
						else
							strmid( _Line, szMessage, ( _i@Index * EX_SPLITLENGTHH ), ( _i@Index * EX_SPLITLENGTHH ) + EX_SPLITLENGTHH );

						if( _iL > 1 )
						{
							if( _i@Index > 0 )
							{
								format( _Line, sizeof _Line, "... %s", _Line );
							}
						}
						nearByMessage(playerid, COLOR_GREY, _Line);
						_i@Index++;
					}
				format(szMessage, sizeof(szMessage), "\"%s\"", text);
				SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 15.0, 10000);

				//		format(szMessage, sizeof(szMessage), "\"%s\"", text);
				//	SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 10.0, 10000);
				}
				else
				{
					foreach(Player, idd)
					{
						if(PlayerData[idd][pPaintBallG] == PlayerData[playerid][pPaintBallG])
						{
		    				format(szMessage,sizeof(szMessage),"{BA3FC1}%s [%d kills]{FFFFFF}: %s",szPlayerName,PlayerData[playerid][pPaintBallKills],text);
							SCM(idd, COLOR_WHITE, szMessage);
						}
					}
				}
		}
		PlayerData[playerid][pSpamCount]++;
	}
	return 0;
}
Why is it restarting? What's wrong?
Reply
#2

bump?
Reply
#3

pawn Код:
assert(AntiFlood_Check(playerid));
This function aborts the execution if AntiFlood_Checkreturns 0. I don't even know why you use it in the first place, it's only meant for testing functions so you can be sure everything works properly with them.

Since crashdetect fails to report (assuming you already have the latest version, if not; update), debug it manually - more print lines.
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
assert(AntiFlood_Check(playerid));
This function aborts the execution if AntiFlood_Checkreturns 0. I don't even know why you use it in the first place, it's only meant for testing functions so you can be sure everything works properly with them.

Since crashdetect fails to report (assuming you already have the latest version, if not; update), debug it manually - more print lines.
This is AntiFlood_Check:
Код HTML:
AntiFlood_Check( playerid, bool:inc=true )
{
	AntiFlood_Data[playerid][floodRate] += inc ? RATE_INC : 0;
	AntiFlood_Data[playerid][floodRate] = AntiFlood_Data[playerid][floodRate] - ( GetTickCount() - AntiFlood_Data[playerid][lastCheck] );
	AntiFlood_Data[playerid][lastCheck] = GetTickCount();
	AntiFlood_Data[playerid][floodRate] = AntiFlood_Data[playerid][floodRate] < 0 ? 0 : AntiFlood_Data[playerid][floodRate];

	if ( AntiFlood_Data[playerid][floodRate] >= RATE_MAX )
	{
		#if THRESOLD_ACTION == 1
			SendClientMessage(playerid,COLOR_LIGHTRED,"Kick: You got kicked because you did spam.");
			Kick(playerid);
		#elseif THRESOLD_ACTION == 2
			SendClientMessage(playerid,COLOR_LIGHTRED,"Kick: You got kicked because you did spam.");
			Kick(playerid);
		#else
			SendClientMessage(playerid, COLOR_LIGHTRED, "Please stop spam." );
		#endif

		return false;
	}

	return true;
}
So, do I have to remove assert(AntiFlood_Check(playerid)); ?

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)