login system
#1

how to move registration system from (OnDialogResponse) to (Onplayerconnect)..
please help...

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
		case LANG_DIALOG:
		{
		    if(response)
        	{
				pLang[playerid] = listitem;
			}
		}
		case FIRST:
		{
			if(!response)	return	 Kick(playerid);
			switch(pLang[playerid])
			{
				case ENGLISH:   ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, ""COL_BLUE"system", "{FFFFFF}Your name is not registered under soldiers list\nChoose your password and don't forget it!", "Register", "Quit");
			}
		}
		case REGISTER:
	    {
			new ip[16];
			GetPlayerIp(playerid, ip, sizeof(ip));
	        if(!response) return Kick(playerid);
	        if (!strlen(inputtext))
	        {
				switch(pLang[playerid])
				{
					case ENGLISH:   ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, ""COL_BLUE"System", "{FFFFFF}Your name is not registered under soldiers list\nChoose your password and don't forget it!", "Register", "Quit");
				}
				return 1;
			}
			new file[50];
			format(file, sizeof(file), SERVER_USER_FILE, GetName(playerid));
    		dini_Create(file);
        	dini_IntSet(file, "Password", udb_hash(inputtext));
			dini_BoolSet(file, "Sniper", PlayerInfo[playerid][sniper]);
			dini_BoolSet(file, "Jet", PlayerInfo[playerid][jet]);
	        dini_BoolSet(file, "Assassin",PlayerInfo[playerid][supporter]);
	        dini_BoolSet(file, "Chemist", PlayerInfo[playerid][chemist]);
	        dini_BoolSet(file, "Suicider",PlayerInfo[playerid][suicider]);
	        dini_BoolSet(file, "Medic", PlayerInfo[playerid][medic]);
	        dini_BoolSet(file, "Pilot",PlayerInfo[playerid][pilot]);
	        dini_BoolSet(file, "Bomber", PlayerInfo[playerid][bomber]);
	        dini_BoolSet(file, "Spy",PlayerInfo[playerid][spy]);
	        dini_BoolSet(file, "Assault", PlayerInfo[playerid][assault]);
	        dini_BoolSet(file, "Engineer",PlayerInfo[playerid][engineer]);
	        dini_BoolSet(file, "AdvancedSoldier",PlayerInfo[playerid][advancedsoldier]);
			dini_IntSet(file, "XP",	GetPlayerScore(playerid));
			dini_IntSet(file, "Cash",GetPlayerMoney(playerid));
	        dini_IntSet(file, "Kills",PlayerInfo[playerid][Kills]);
	        dini_IntSet(file, "Deaths",PlayerInfo[playerid][Deaths]);
	        dini_IntSet(file, "Admin",PlayerInfo[playerid][Admin]);
	        dini_IntSet(file, "Skin",PlayerInfo[playerid][Skin]);
	        dini_Set(file, "IP", ip);
			dini_BoolSet(file, "Banned",PlayerInfo[playerid][Banned]);
			dini_IntSet(file, "InvType",PlayerInfo[playerid][Inv]);
	        dini_IntSet(file, "Vip",PlayerInfo[playerid][Vip]);
	        gPlayerLogged{playerid } = true;
	        switch(pLang[playerid])
			{
				case ENGLISH:   ShowPlayerDialog(playerid, TEAM_SELECTION1, DIALOG_STYLE_MSGBOX, ""COL_BLUE"War-"COL_RED"Z", "{FFFFFF}Where Are You From?\nSelect your continent now!\nNOTICE: We have supplied you with a Rifle, a Shotgun and a 9mm pistol.\nHold your breath.", "Select","");
			}
		}
	    case LOGIN:
	    {
	        if(!response) return Kick(playerid);
	        if (!strlen(inputtext))
			{
				switch(pLang[playerid])
				{
					case ENGLISH:   ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, ""COL_BLUE"War-"COL_RED"Z", "\n\nIngrese su contraseсa para acceder a su posiciуn!", "Login", "Leave");
				}
			}
			new tmp;
         	new file[50];
         	format(file, sizeof(file), SERVER_USER_FILE, GetName(playerid));
     	   	tmp = dini_Int(file, "Password");
	        if(udb_hash(inputtext) != tmp)
			{
				switch(pLang[playerid])
				{
					case ENGLISH:   ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""COL_RED"Wrong Password", "\n\nWhat? Are you a spy?!\n ow enter your correct password before you get "COL_RED"kicked!(You can see your input now)", "Login", "Leave");
				}
				return 1;
			}
			if(dini_Bool(file, "Banned"))    return  Kick(playerid);
            PlayerInfo[playerid][sniper] = dini_Bool(file, "Sniper") ? true : false;
            PlayerInfo[playerid][jet] = dini_Bool(file, "Jet") ? true : false;
            PlayerInfo[playerid][supporter] = dini_Bool(file, "Assassin") ? true : false;
            PlayerInfo[playerid][chemist] = dini_Bool(file, "Chemist") ? true : false;
            PlayerInfo[playerid][suicider] = dini_Bool(file, "Suicider") ? true : false;
            PlayerInfo[playerid][medic] = dini_Bool(file, "Medic") ? true : false;
            PlayerInfo[playerid][pilot] = dini_Bool(file, "Pilot") ? true : false;
            PlayerInfo[playerid][bomber] = dini_Bool(file, "Bomber") ? true : false;
            PlayerInfo[playerid][spy] = dini_Bool(file, "Spy") ? true : false;
            PlayerInfo[playerid][assault] = dini_Bool(file, "Assault") ? true : false;
            PlayerInfo[playerid][engineer] = dini_Bool(file, "Engineer") ? true : false;
            PlayerInfo[playerid][advancedsoldier] = dini_Bool(file, "AdvancedSoldier") ? true : false;
            PlayerInfo[playerid][Skin] = dini_Int(file, "Skin");
            SetPlayerScore(playerid, dini_Int(file, "XP"));
            PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
            PlayerInfo[playerid][Deaths] = dini_Int(file, "Deaths");
            PlayerInfo[playerid][Admin] = dini_Int(file, "Admin");
            PlayerInfo[playerid][Inv] = dini_Int(file, "InvType");
	    GivePlayerMoney(playerid, dini_Int(file, "Cash"));
            PlayerInfo[playerid][Vip] = dini_Int(file, "Vip");
	   gPlayerLogged{playerid } = true;
thank you..
Reply
#2

please . someone help me
Reply
#3

Just add ShowPlayerDialog(whatever, params, you, want); under OnPlayerConnect?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)