SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/11/2013, 09:15 AM   #1
bigtigerbeee
Big Clucker
 
bigtigerbeee's Avatar
 
Join Date: Oct 2012
Location: Thailand
Posts: 107
Reputation: 6
Default setplayername server crash helpme [crash detect]

Delete Thx a lot

Last edited by bigtigerbeee; 28/11/2013 at 11:52 AM.
bigtigerbeee is offline   Reply With Quote
Old 27/11/2013, 09:21 AM   #2
Voxel
Gangsta
 
Voxel's Avatar
 
Join Date: Sep 2013
Location: The Netherlands
Posts: 578
Reputation: 70
Default Re: setplayername server crash helpme [crash detect]

show us your script or where the error part is
__________________
My Work:
[GameMode]The Nether Survival
[Filterscript]SQLite Database Start
[Tutorial]SQLite Commands
[Tutorial]Loot/ Inventory System
[Tutorial]Simple Hunger/Thirst System
[Tutorial]Converting Binary
[Map]Tropical Island + Pier
[Map]San Fierro Apocalypse
Voxel is offline   Reply With Quote
Old 27/11/2013, 09:31 AM   #3
bigtigerbeee
Big Clucker
 
bigtigerbeee's Avatar
 
Join Date: Oct 2012
Location: Thailand
Posts: 107
Reputation: 6
Default Re: setplayername server crash helpme [crash detect]

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);
			}
		}
bigtigerbeee is offline   Reply With Quote
Old 27/11/2013, 10:07 AM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: setplayername server crash helpme [crash detect]

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]);
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 28/11/2013, 12:23 AM   #5
bigtigerbeee
Big Clucker
 
bigtigerbeee's Avatar
 
Join Date: Oct 2012
Location: Thailand
Posts: 107
Reputation: 6
Default Re: setplayername server crash helpme [crash detect]

Thank a lot Konstantions
bigtigerbeee is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Helpme crash detect plugin i got logs bigtigerbeee Scripting Help 2 27/11/2013 02:03 AM
Crash Detect Report/Server Crashing Insulin Server Support 3 23/08/2013 04:29 PM
Crash Detect Log Tamer Scripting Help 4 22/07/2013 12:24 PM
Server Crashing :: Crash Detect Results StuartD Server Support 5 08/02/2013 08:42 AM


All times are GMT. The time now is 05:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.