[Ajuda] Dialog's no registo e no Login
#1

Boas pessoal, eu uso o Carlitos-Roleplay.
Sу preciso de mudar por agora, para meter em dialog.
Ou seja, o CRP, й um gamemode ao entrar no jogo, carrega-se no T, e digitamos logo a password.
Vou deixar aqui as minhas funзoes, queria que me ajudassem a meter em Dialog sff.

Код:
public OnPlayerRequestClass(playerid, classid)
{
     return 1;
}
Код:
public OnPlayerRequestSpawn(playerid)
{
      SpawnPlayer(playerid);
	  return 1;
}
Код:
public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid,COLOR_RED,"___________________________________________________________________");
	SendClientMessage(playerid,COLOR_YELLOW,"Bem Vindo.");
	SendClientMessage(playerid,COLOR_RED,"___________________________________________________________________");
	return 1;
}
Код:
public OnPlayerRegister(playerid, password[])
{
	if(IsPlayerConnected(playerid))
	{
			new string[128];
            new string3[128];
			format(string3, sizeof(string3), "CRP_Scriptfiles/Accounts/%s.ini", PlayerName(playerid));
			new File: hFile = fopen(string3, io_write);
			if (hFile)
			{
			    strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
			    new var[32];
				format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
				PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
				format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
				format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
				format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
				format(var, 32, "Registered=%d\n",PlayerInfo[playerid][pRegistered]);fwrite(hFile, var);
				format(var, 32, "Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
				format(var, 32, "Age=%d\n",PlayerInfo[playerid][pAge]);fwrite(hFile, var);
				format(var, 32, "Experience=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
				format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
				format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
				format(var, 32, "Skin=%d\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
				format(var, 32, "Drugs=%d\n",PlayerInfo[playerid][pDrugs]);fwrite(hFile, var);
				format(var, 32, "Materials=%d\n",PlayerInfo[playerid][pMaterials]);fwrite(hFile, var);
				format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
				format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pPlayingHours]);fwrite(hFile, var);
				format(var, 32, "AllowedPayday=%d\n",PlayerInfo[playerid][pAllowedPayday]);fwrite(hFile, var);
				format(var, 32, "PayCheck=%d\n",PlayerInfo[playerid][pPayCheck]);fwrite(hFile, var);
				format(var, 32, "Faction=%d\n",PlayerInfo[playerid][pFaction]);fwrite(hFile, var);
				format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
				format(var, 32, "HouseKey=%d\n",PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
				format(var, 32, "BizKey=%d\n",PlayerInfo[playerid][pBizKey]);fwrite(hFile, var);
				format(var, 32, "SpawnPoint=%d\n",PlayerInfo[playerid][pSpawnPoint]);fwrite(hFile, var);
				format(var, 32, "Banned=%d\n",PlayerInfo[playerid][pBanned]);fwrite(hFile, var);
				format(var, 32, "Warnings=%d\n",PlayerInfo[playerid][pWarnings]);fwrite(hFile, var);
				format(var, 32, "CarLic=%d\n",PlayerInfo[playerid][pCarLic]);fwrite(hFile, var);
				format(var, 32, "FlyLic=%d\n",PlayerInfo[playerid][pFlyLic]);fwrite(hFile, var);
				format(var, 32, "WepLic=%d\n",PlayerInfo[playerid][pWepLic]);fwrite(hFile, var);
				format(var, 32, "PhoneNumber=%d\n",PlayerInfo[playerid][pPhoneNumber]);fwrite(hFile, var);
				format(var, 32, "PhoneC=%d\n",PlayerInfo[playerid][pPhoneC]);fwrite(hFile, var);
				format(var, 32, "PhoneBook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
				format(var, 32, "ListNumber=%d\n",PlayerInfo[playerid][pListNumber]);fwrite(hFile, var);
				format(var, 32, "Donator=%d\n",PlayerInfo[playerid][pDonator]);fwrite(hFile, var);
				format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
				format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
				format(var, 32, "Products=%d\n",PlayerInfo[playerid][pProducts]);fwrite(hFile, var);
				format(var, 32, "CrashX=%f\n",PlayerInfo[playerid][pCrashX]);fwrite(hFile, var);
				format(var, 32, "CrashY=%f\n",PlayerInfo[playerid][pCrashY]);fwrite(hFile, var);
				format(var, 32, "CrashZ=%f\n",PlayerInfo[playerid][pCrashZ]);fwrite(hFile, var);
				format(var, 32, "CrashInt=%d\n",PlayerInfo[playerid][pCrashInt]);fwrite(hFile, var);
				format(var, 32, "CrashW=%d\n",PlayerInfo[playerid][pCrashW]);fwrite(hFile, var);
				format(var, 32, "Crashed=%d\n",PlayerInfo[playerid][pCrashed]);fwrite(hFile, var);
	            PlayerInfo[playerid][pReg] = 0;
				fclose(hFile);
			}
	}
	return 1;
}
Код:
public OnPlayerLogin(playerid,password[])
{
    new string2[128];
	format(string2, sizeof(string2), "CRP_Scriptfiles/Accounts/%s.ini", PlayerName(playerid));
	new File: UserFile = fopen(string2, io_read);
	if ( UserFile )
	{
	    new PassData[256];
	    new keytmp[256], valtmp[256];
	    fread( UserFile , PassData , sizeof( PassData ) );
	    keytmp = ini_GetKey( PassData );
	    if( strcmp( keytmp , "Key" , true ) == 0 )
		{
			valtmp = ini_GetValue( PassData );
			strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
		{
			    new key[ 256 ] , val[ 256 ];
			    new Data[ 256 ];
			    while ( fread( UserFile , Data , sizeof( Data ) ) )
				{
					key = ini_GetKey( Data );
					if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
			    	if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
			        if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
			        if( strcmp( key , "Registered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRegistered] = strval( val ); }
					if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
					if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
					if( strcmp( key , "Experience" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
					if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
					if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
					if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
					if( strcmp( key , "Drugs" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrugs] = strval( val ); }
					if( strcmp( key , "Materials" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMaterials] = strval( val ); }
					if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJob] = strval( val ); }
					if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPlayingHours] = strval( val ); }
					if( strcmp( key , "AllowedPayday" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAllowedPayday] = strval( val ); }
					if( strcmp( key , "PayCheck" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayCheck] = strval( val ); }
					if( strcmp( key , "Faction" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFaction] = strval( val ); }
					if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
					if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHouseKey] = strval( val ); }
					if( strcmp( key , "BizKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBizKey] = strval( val ); }
					if( strcmp( key , "SpawnPoint" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnPoint] = strval( val ); }
					if( strcmp( key , "Banned" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBanned] = strval( val ); }
					if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarnings] = strval( val ); }
					if( strcmp( key , "CarLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarLic] = strval( val ); }
					if( strcmp( key , "FlyLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlyLic] = strval( val ); }
					if( strcmp( key , "WepLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWepLic] = strval( val ); }
					if( strcmp( key , "PhoneNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneNumber] = strval( val ); }
					if( strcmp( key , "PhoneC" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneC] = strval( val ); }
					if( strcmp( key , "PhoneBook" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneBook] = strval( val ); }
					if( strcmp( key , "ListNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pListNumber] = strval( val ); }
					if( strcmp( key , "Donator" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonator] = strval( val ); }
					if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
					if( strcmp( key , "JailTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailTime] = strval( val ); }
					if( strcmp( key , "Products" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pProducts] = strval( val ); }
					if( strcmp( key , "CrashX" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashX] = floatstr( val ); }
					if( strcmp( key , "CrashY" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashY] = floatstr( val ); }
					if( strcmp( key , "CrashZ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashZ] = floatstr( val ); }
					if( strcmp( key , "CrashInt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashInt] = strval( val ); }
					if( strcmp( key , "CrashW" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashW] = strval( val ); }
					if( strcmp( key , "Crashed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrashed] = strval( val ); }
                }
                fclose(UserFile);
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrect password!");
	        fclose(UserFile);
	        return 1;
		}
	    if(PlayerInfo[playerid][pFaction] != 255)
	    {
    		if(DynamicFactions[PlayerInfo[playerid][pFaction]][fUseColor])
    		{
    			SetPlayerToFactionColor(playerid);
    		}
     	}
     	else
     	{
			SetPlayerColor(playerid,COLOR_CIVILIAN);
		}
		if(PlayerInfo[playerid][pBanned])
		{
		    KickPlayer(playerid,"System","Account Banned.");
		}
		if(PlayerInfo[playerid][pRegistered] == 0)
		{
			PlayerInfo[playerid][pLevel] = 1;
			PlayerInfo[playerid][pCash] = 2500;
			PlayerInfo[playerid][pBank] = 7500;
			PlayerInfo[playerid][pSkin] = 200;
			SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
			TogglePlayerControllable(playerid,0);
			SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[INFO:] You have not yet set your age, set it now by typing ages between 16-100.");
			RegistrationStep[playerid] = 1;
		}
		SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_YELLOW2, "[INFO:] Successfully logged in.");
		gPlayerLogged[playerid] = 1;
		SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z],0,0,0,0,0,0,0);
		SpawnPlayer(playerid);
	}
	return 1;
}
Reply
#2

eu sу nao sei й por em dialog, mas jб o usei o search :c
Reply
#3

Sorry, pelo o double post.
Mas alguem me poderia ajudar, se faz favor ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)