setplayername server crash helpme [crash detect]
#1

Delete Thx a lot
Reply
#2

show us your script or where the error part is
Reply
#3

I think it

Code:
	    case DIALOG_RP_NAME_CHANGE: {
	    	new
				charCounts[5];

			if(strlen(inputtext) > 20) {
			    SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШіµйН§БХ¤ЗТБВТЗµиУЎЗиТ 20 µСЗНСЎЙГ");
				invalidNameChange(playerid);
			    return 1;
			}

			format(szPlayerName, MAX_PLAYER_NAME, "%s", inputtext);

			for(new n; n < MAX_PLAYER_NAME; n++) {
				switch(szPlayerName[n]) {
					case '[', ']', '.', '$', '(', ')', '@', '=': charCounts[1]++;
					case '_': charCounts[0]++;
					case '0' .. '9': charCounts[2]++;
					case 'a' .. 'z': charCounts[3]++;
					case 'A' .. 'Z': charCounts[4]++;
				}
			}
			if(charCounts[0] == 0 || charCounts[0] >= 3) {
					SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШідБи¶ЩЎµйН§ {FFFFFF}ЎГШіТгЄйа¤ГЧиН§ЛБТВ КС*»ГРЎТИ '_' аѕЧиНбВЎГРЛЗиТ§ЄЧиНбЕР№ТБКЎШЕ (µСЗНВиТ§ Dennis_Ritchie)");
					invalidNameChange(playerid);
			}
			else if(charCounts[1] >= 1) {
					SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШідБи¶ЩЎµйН§, »ГСͺ仴йЗВКС*ЕСЎЙімѕФаИЙ ЎГШіТгЄйЄЧиНбєє Roleplay (µСЗНВиТ§ James_Gosling)");
					invalidNameChange(playerid);
			}
			else if(charCounts[2] >= 1) {
					SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШідБи¶ЩЎµйН§, »ГСͺ仴йЗВµСЗаЕў ЎГШіТгЄйЄЧиНбєє Roleplay (µСЗНВиТ§ Alan_Cooper)");
					invalidNameChange(playerid);
			}
			else if(charCounts[3] == strlen(szPlayerName) - 1) {
					SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШідБи¶ЩЎµйН§, БХбµиНСЎЙГµСЗаЕзЎ ЎГіТгЄйЄЧиНбєє Roleplay (µСЗНВиТ§ James_Miller)");
					invalidNameChange(playerid);
			}
			else if(charCounts[4] == strlen(szPlayerName) - 1) {
					SendClientMessage(playerid, COLOR_GREY, "ЄЧиНўН§¤ШідБи¶ЩЎµйН§, БХбµиНСЎЙГµСЗгЛ*и ЎГіТгЄйЄЧиНбєє Roleplay (µСЗНВиТ§ Michael_Scofield)");
					invalidNameChange(playerid);
			}
			else {
			    mysql_real_escape_string(inputtext, PlayerInfo[playerid][pNormalName]);
			    SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);

				format(szQueryOutput, sizeof(szQueryOutput), "SELECT `playerName` FROM `playeraccounts` WHERE `playerName` = '%s'", PlayerInfo[playerid][pNormalName]);
			    mysql_query(szQueryOutput, THREAD_CHECK_ACCOUNT_USERNAME, playerid);
			}
		}
Reply
#4

Quote:
Originally Posted by bigtigerbeee
View Post
pls I got a crash detect

Code:
[16:53:13] [debug] Server crashed while executing tolrp.amx
[16:53:13] [debug] AMX backtrace:
[16:53:13] [debug] #0 native SetPlayerName () [01ee5700] from sscanf.dll
[16:53:13] [debug] #1 000b77cc in public OnDialogResponse (0x00000006, 0x00000037, 0x00000000, 0xffffffff, 0x00342380) from tolrp.amx
[16:53:13] [debug] Native backtrace:
thank
I think SetPlayerName crashes the server if the new name is NULL/empty.

pawn Code:
// Add it under the includes:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
and then check if it's not null and set the name, else do not.
pawn Code:
if(!isnull(PlayerInfo[playerid][pNormalName])) SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
Reply
#5

Thank a lot Konstantions
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)