Saving System
#5

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Helper",0);
                INI_WriteInt(File,"Prisoned",0);
                INI_WriteInt(File,"Wanted",0);
                INI_WriteInt(File,"Arrests",0);
                INI_WriteInt(File,"Crimes",0);
                INI_WriteInt(File,"Jailed",0);
                INI_WriteInt(File,"Level",1);
                INI_WriteInt(File,"Warnings",0);
                INI_WriteInt(File,"CSR",0);
                INI_WriteInt(File,"Order",0);
                INI_WriteInt(File,"Character",0);
                INI_WriteInt(File,"Interior",0);
                INI_WriteInt(File,"VirtualWorld",0);
                INI_WriteInt(File,"Pot",0);
                INI_WriteInt(File,"Heroin",0);
                INI_WriteInt(File,"Crack",0);
                INI_WriteInt(File,"Meth",0);
                INI_WriteInt(File,"GiftTime",0);
                INI_WriteInt(File,"PlayingHours",0);
                INI_WriteInt(File,"Exp",0);
                INI_WriteInt(File,"Faction",0);
                INI_WriteInt(File,"Rank",0);
                INI_WriteInt(File,"Leader",0);
                INI_WriteInt(File,"Member",0);
                INI_WriteInt(File,"Accept",0);
                INI_WriteInt(File,"FMember",0);
                INI_WriteInt(File,"Division",0);
                INI_WriteInt(File,"Restricted",0);
                INI_WriteInt(File,"AGuns",0);
                INI_WriteInt(File,"Guns",0);
                INI_WriteInt(File,"GunAmmo",0);
                INI_WriteInt(File,"AMSSent",0);
                INI_WriteInt(File,"ReportsAccepted",0);
                INI_WriteInt(File,"BadgeNumber",0);
                INI_Close(File);
				SetPlayerCameraPos(playerid,1520.2188,-1712.0742,40.5350);
				SetPlayerCameraLookAt(playerid,1478.4708,-1754.7579,16.7400);
				ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server", " This is the Government HQ where the Mayor/ Governor makes all the financial decisions!\n Los Angeles Life Style Roleplay would like to welcome you to Los Angeles\n and hope you have a smashing time!", "OK","No");
				SetTimerEx("SaveChar", 100, true, "i", playerid);
				GivePlayerMoney(playerid, 10000);
            }
        }
		case DIALOG_LOGIN:
        {
            if(!response) return Kick (playerid);
            if(response)
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, 299, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ],0, 0, 0, 0, 0, 0, 0);
	                SpawnPlayer(playerid);
	                SetCameraBehindPlayer(playerid);
	                SetTimerEx("SaveChar", 200000, true, "i", playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
            }
		}
 		case DIALOG_RULES:
    	{
			if(!response) return Kick(playerid);
			else
			{
				SetPlayerPos(playerid, 1478.4708,-1754.7579,-10.0);
                SetCameraBehindPlayer(playerid);
			    ShowPlayerDialog(playerid,DIALOG_SHOW_INFO,DIALOG_STYLE_MSGBOX, "{12C1ED}Rules", "{12C1ED}By registering at Los Angeles Life Style Roleplay, you have accepted our policies and rules.", "Okay", "");
			    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hello, welcome to Los Angeles Life Style Roleplay, this is a new developed server by Callum Riley, if you find any bugs");
			    SendClientMessage(playerid, COLOR_LIGHTBLUE, "please report them to a high administrator, preferbly an Shift Manager +");
			    SendClientMessage(playerid, COLOR_YELLOW, "We hope you enjoy your time here at Los Angeles Life Style Roleplay! Remember: /rules");
			    PlayerInfo[playerid][pX] = 1780.1759;
			    PlayerInfo[playerid][pY] = -1933.6698;
			    PlayerInfo[playerid][pZ] = 13.3859;
			    PlayerInfo[playerid][pCash] = 10000;
				PlayerInfo[playerid][pPot] += 5;
				PlayerInfo[playerid][pCrack] += 6;
				PlayerInfo[playerid][pMeth] += 3;
				PlayerInfo[playerid][pHeroin] += 10;
				PlayerInfo[playerid][pExp] += 3;
				PlayerInfo[playerid][pTime] += 3;
				PlayerInfo[playerid][pChar] = 170;
    			SetSpawnInfo(playerid, 0, 299, 1780.1759,-1933.6698,13.3859,356.5534, 0, 0, 0, 0, 0, 0);
			}
		}
	}
	return 1;
}
That is my OnDialogResponse..
Reply


Messages In This Thread
Saving System - by MrCallum - 31.12.2014, 20:20
Re: Saving System - by CalvinC - 31.12.2014, 20:32
Re: Saving System - by MrCallum - 31.12.2014, 21:05
Re: Saving System - by AndySedeyn - 31.12.2014, 21:08
Re: Saving System - by MrCallum - 31.12.2014, 21:12
Re: Saving System - by AndySedeyn - 31.12.2014, 21:21
Re: Saving System - by MrCallum - 31.12.2014, 21:23
Re: Saving System - by AndySedeyn - 31.12.2014, 21:27
Re: Saving System - by MrCallum - 31.12.2014, 21:29
Re: Saving System - by AndySedeyn - 31.12.2014, 21:31

Forum Jump:


Users browsing this thread: 1 Guest(s)