Some Login Dialog Help
#1

I have a server and am the only scripter and ama noob in this..Kinda

When someone connects to the server.It dislpays a register/login Dialog box.if someone clicks on Login..If password is entered it does its work.But if somehow someone clicks on cancel it closes the server connection..Saying "Server closed the connection"..This not only affects here.But on all the Dialog box i add in the server.If someone clicks on the right tab it closes the connection Please help..

This is my OnPlayerConnect Code
Код:
public OnPlayerConnect(playerid)
{
	new string[MAX_PLAYER_NAME];
	ResetStats(playerid);
	new Country[256];
    GetPlayerCountry(playerid,Country);
    new mess[256],IP[256];
	new plname[256];
	GetPlayerIp(playerid,IP,sizeof(IP));
	format(mess,sizeof(mess),"%s has joined the server.[Country: %s |IP Address: %s |Ping: %i ]",plname,Country,IP,GetPlayerPing(playerid));
	printf(mess);
	ABroadCast(COLOR_YELLOW,mess,1);
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~ ~b~80z ~i~ ~P~Gang ~W~Warz", 2000, 3);
	SendClientMessage(playerid, COLOR_RED, "This Server contains Violent acts ,you've been warned");
 	gActivePlayers[playerid]++;
	numplayers++;
	format(string, sizeof(string), "%s.ini", PlayerName(playerid));
	if(!dini_Exists(string))
	{
		gPlayerAccount[playerid] = 0;
 		new regstring[256];
		new regname[64];
		SendClientMessage(playerid, COLOR_YELLOW, "You dont have an account. Please register your account to proceed.");
		GetPlayerName(playerid,regname,sizeof(regname));
		format(regstring,sizeof(regstring),"80'z Gang WarZ\nPlease register your account by typing you password below");
		ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
		return 1;
	}
	else
	{
	    gPlayerAccount[playerid] = 1;
 	 	new loginstring[256];
		new loginname[64];
		SendClientMessage(playerid, COLOR_WHITE, "SERVER: That name is registered, please wait to login");
		SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now login by typing your password below");
		GetPlayerName(playerid,loginname,sizeof(loginname));
		format(loginstring,sizeof(loginstring),"80z Gang WarZ\nThat name is registered. please enter your password below");
		ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
        //========= [ Car Exports ] ==========//
        SetPlayerCheckpoint(playerid, 2237.41, -2492.02, 13.54, 5.0);
	    new vehicleName[32] = "";
	    for(new i=0; i < MAX_EXPORTVEHICLES; i++) {
		    if(ExportVehicles[i] == ExportVehicle) {
			    format(vehicleName, sizeof(vehicleName), "%s",ExportVehicleNames[i] );
		    }
	    }
	    if(strlen(vehicleName) != 0)
		{
	    format(string, sizeof(string), "Exports are currently buying %s's.",vehicleName);
	    SendClientMessage(playerid, COLOR_NICEBLUE, string);
		}
		
		TextDrawShowForPlayer(playerid, NWORP1);
		//=========================[MAP-ICONS]======================================
		
	    SetPlayerMapIcon( playerid, 49, 2310.99, -1649.97, 14.18, 49, 0);//TGB
	    SetPlayerMapIcon( playerid, 12, 1553.3510, -1675.4082, 16.1953, 30, 0); // LSPD
        gOoc[playerid] = 0;
        InJail[playerid] = 0;
        InStunt[playerid] = 0;
        return 1;
	}
}
Reply
#2

You need to post your OnPlayerDialogResponse. That's where your problem would be.
Reply
#3

Off topic but why..

pawn Код:
IP[256];
and not
pawn Код:
IP[22];
?
Reply
#4

Quote:
Originally Posted by Souvlaki
Посмотреть сообщение
Off topic but why..

pawn Код:
IP[256];
and not
pawn Код:
IP[22];
?
Should be ip[16];
Reply
#5

Why would use do IP[256]; when someones IP won't even be that big? See this is why everyone asks why there script lags its because they do the stupidest things.
Reply
#6

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Should be ip[16];
Yeah your right, my epic fail.I miscounted :S
Reply
#7

Allright as i said im a Newbie!!
Ip should not be 256...
But a problem in that code is That it deosnt shows players name when someone connects to the server..
Please help with that too!!

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new string[256];
	if(response)
	{
		if(dialogid == 12346 || dialogid == 12347)
		{
		    if(strlen(inputtext))
		    {
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				OnPlayerLogin(playerid,tmppass);
			}
			else 
			{
				new loginstring[256];
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password");
				format(loginstring,sizeof(loginstring),"80'z Gz Gang WarZ\nThat name is registered. please enter your password below");
		        ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
			}
		}
		if(dialogid == 12345)
		{
		    if(strlen(inputtext))
		    {
				format(string, sizeof(string), "%s.ini", PlayerName(playerid));
                if(dini_Exists(string))
	            {
					SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				OnPlayerRegister(playerid, tmppass);
			}
			else
			{
 				new regstring[256];
				format(regstring,sizeof(regstring),"80'z Gz Gang WarZ\nThat name is not registered. type your password below to register");
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
			}
	    }
	}
	else
	{
		Kick(playerid);
	}
	return 1;
}
Reply
#8

pawn Код:
else
    {
        Kick(playerid);
    }
That's why when you press cancel, you get kicked.
Reply
#9

Quote:
Originally Posted by Souvlaki
Посмотреть сообщение
pawn Код:
else
    {
        Kick(playerid);
    }
That's why when you press cancel, you get kicked.
So can you give me a corrected code plz?
Reply
#10

pawn Код:
else
    {
SendClientMessage(playerid, COLOR_RED, "Your pressed cancel.");
//or do smth else
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)