Non-RP name server crash
#1

Players are joining my server with non-RP names and so my gamemode gives them a dialog to change their name but they type random stuff and it crashes the whole entire server.
Here is an example of the server log.
Код:
[18:51:22] Incoming connection: 212.252.22.76:63210
[18:51:23] [join] semih has joined the server (0:212.252.22.76)
[18:51:30] [nick] semih nick changed to selo3779
[18:51:34] [nick] selo3779 nick changed to 373737
[18:51:44] [nick] 373737 nick changed to selo3779

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3x-R2, ©2005-2013 SA-MP Team

[18:52:09] 
[18:52:09] Server Plugins
[18:52:09] --------------
[18:52:09]  Loading plugin: sscanf
[18:52:09] 

[18:52:09]  ===============================

[18:52:09]       sscanf plugin loaded.     

[18:52:09]          Version:  2.8.1        

[18:52:09]    © 2012 Alex "******" Cole  

[18:52:09]  ===============================
Will +Rep anyone who can help.
Reply
#2

You didn't have that much information so we can help you. Post the part of code that they change their name and load crashdetect plugin.
Reply
#3

first i prefer kicking and sendingclientmessage to player with no rp name but... Mostly you bugged you script and it should be fixed if you post dialog. Script should get name and if name got any number show dialog for player and allalong till he do not accept rp name. Do no script anything extreme
Reply
#4

Код:
forward LoadingScreen(playerid);
public LoadingScreen(playerid)
{
    if(fexist(UserPath(playerid)))
    {
	    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
	    if(PlayerInfo[playerid][pBanned] > 0)
	    {
	    	Connected[playerid] = 0;
	    	SendClientMessage(playerid, COLOR_ORANGE, "This account name is banned from the server. Please appeal your ban at http://forums.legion-of-la.com");
			Kick(playerid);
			return 1;
		}
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
        SetPVarInt(playerid, "prelogin", 1);
        InterpolateCameraPos(playerid, 2356.6528, -1742.2469, 142.7728, 1174.76, -1377.98, 150.88, 50000, CAMERA_MOVE);
		InterpolateCameraLookAt(playerid, 1513.8353, -1655.7241, 58.0422, 1513.8353, -1655.7241, 58.0422, 50000, CAMERA_MOVE);
    }
    else
    {   new ip[126]; GetPlayerIp(playerid, ip, 126);
        new str[126];
        SetPVarInt(playerid, "prelogin", 1);
        format(str, sizeof(str), ""COL_WHITE"Type your password below to register a new account. Your IP is %s", ip);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",str,"Register","Quit");
        InterpolateCameraPos(playerid, 2356.6528, -1742.2469, 142.7728, 1174.76, -1377.98, 150.88, 50000, CAMERA_MOVE);
		InterpolateCameraLookAt(playerid, 1513.8353, -1655.7241, 58.0422, 1513.8353, -1655.7241, 58.0422, 50000, CAMERA_MOVE);
		SetPVarInt(playerid, "Quiz", 1);
    }
    new PlayerName2[MAX_PLAYER_NAME], Length;
	GetPlayerName(playerid, PlayerName2, sizeof(PlayerName2));
	Length = strlen(PlayerName2);
	if(PlayerName2[Length - 1] == '_' || PlayerName2[0] == '_' || strfind(PlayerName2, "_", false) == -1)
	{
		SendClientMessage(playerid, COLOR_CYAN, "You have failed to connect with a role play name, please select another name.");
		ShowPlayerDialog(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Type in another name to play with. \nFirstname_Lastname","Change","No!");
		return 1;
	}
    return 1;
}
OnDialogResponse:
Код:
case DIALOG_NAME:
		{
		    if(!response)
		    {
				Kick(playerid);
			}
			if(response)
			{
			    SetPlayerName(playerid, inputtext);
    			new Name[MAX_PLAYER_NAME], Len;
				GetPlayerName(playerid, Name, sizeof(Name));
				Len = strlen(Name);
				if(Name[Len - 1] == '_' || Name[0] == '_' || strfind(Name, "_", false) == -1)
				{
					SendClientMessage(playerid, COLOR_CYAN, "You failed to select a role play name, please select another name.");
					ShowPlayerDialog(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Type in another name to use. \nFirstname_Lastname","Change","No!");
					return 1;
				}
				INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
			}
		}
Reply
#5

I loaded the crash detect plugin and it crashed again. Here is the log:
Код:
:55:45] Incoming connection: 85.70.207.194:53250
[20:55:46] [join] tomas963 has joined the server (0:85.70.207.194)
[20:55:56] [nick] tomas963 nick changed to plokijek
[20:55:58] Jayde Foster's character has saved successfully.
[20:55:59] [nick] plokijek nick changed to aspdfk
[20:56:01] [debug] Server crashed while executing LLA_v1.3.amx
[20:56:01] [debug] AMX backtrace:
[20:56:01] [debug] #0 native SetPlayerName () [10006fb0] from sscanf.DLL
[20:56:01] [debug] #1 0006688c in ?? (0x00000000, 0x00000007, 0x00000001, 0xffffffff, 0x014c2cf4) from LLA_v1.3.amx
[20:56:01] [debug] #2 00008c40 in public OnDialogResponse (0x00000000, 0x00000007, 0x00000001, 0xffffffff, 0x014c2cf4) from LLA_v1.3.amx
[20:56:01] [debug] Native backtrace:
[20:56:01] [debug] #0 00468564 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #1 10007029 in ?? () from C:\DylanPrimic\SAMP\plugins\sscanf.DLL
[20:56:01] [debug] #2 004010b6 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #3 71c65f2a in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #4 71c6822e in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #5 71c5ff6f in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #6 71c65f7a in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #7 0046dac1 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #8 00452850 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #9 71c5ff6f in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #10 71c65f7a in ?? () from C:\DylanPrimic\SAMP\plugins\crashdetect.DLL
[20:56:01] [debug] #11 00458a9c in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #12 0045b26a in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #13 76f6e023 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[20:56:01] [debug] #14 758814ad in ?? () from C:\Windows\syswow64\kernel32.dll
[20:56:01] [debug] #15 00492be1 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #16 00450886 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #17 458d5151 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #18 15ff50f8 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
[20:56:01] [debug] #19 004a60c4 in ?? () from C:\DylanPrimic\SAMP\samp-server.exe
Reply
#6

Native SetPlayerName crashes the server if it's null. There's a macro in zcmd.inc and YSI which is called isnull. Just check if it's not null before setting the name.
Reply
#7

Could you explain it please? I dont really understand
Reply
#8

pawn Код:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
pawn Код:
// OnDialogResponse -> case DIALOG_NAME:
if (!isnull(inputtext)) SetPlayerName(playerid, inputtext);
else return ShowPlayerDialog(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Type in another name to play with. \nFirstname_Lastname","Change","No!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)