03.06.2013, 17:02
Dialog:
Stocks:
Sу salva a senha, vida e colete
Espero ajuda
Код:
if(dialogid == DialogRegistro) { if(response) { if(!strlen(inputtext)) { new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[120]; format(String, sizeof(String), "{00BFFF}Nick: {FFA500}%s {FF0000}Nгo Registrado\n\n{FFFFFF} Digite Uma Senha Para Continuar", Nome); ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "Registro", String, "Registrar", "Cancelar"); SendClientMessage(playerid,0x1E90FFAA,"Senha invalida, digite uma senha vбlida"); return 1; } new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[100]; format(String, sizeof(String), Contas, Nome); DadosPlayer[playerid][Level] = 1; DOF2_CreateFile(String); DOF2_SetString(String,"Senha",inputtext); DOF2_SetInt(String,"Level",0); DOF2_SetInt(String,"Admin",0); DOF2_SetInt(String,"Skin",0); DOF2_SetInt(String,"Sexo",0); DOF2_SetInt(String,"Dinheiro",0); DOF2_SetInt(String,"Vida", 100); DOF2_SetInt(String,"Colete", 100); DOF2_SetInt(String,"Matou",0); DOF2_SetInt(String,"Morreu",0); DOF2_SaveFile(); //Sexo format(String, sizeof(String), "Escolha o seu sexo"); ShowPlayerDialog(playerid, DialogSexo, DIALOG_STYLE_MSGBOX, "Sexo", String, "Homem", "Mulher"); return 1; } else { SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo quis se registrar, por este motivo serб Kickado!"); Kick(playerid); return 1; } } if(dialogid == DialogLogin) { if(response) { if(!strlen(inputtext)) { new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[100]; format(String, sizeof(String), "{00BFFF}Nick: {FFA500}%s {00FF00}Registrado\n\n{FFFFFF} Digite Sua Senha Para Logar", Nome); ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "Login", String, "Logar", "Cancelar"); SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta!"); return 1; } new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[100]; format(String, sizeof(String), Contas, Nome); if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false)) { SetarPlayer(playerid); return 1; } else { format(String, sizeof(String), "{FFFFFF}Senha incorreta digite-a novamente\n\n{FFFFFF} Se errar 5 vezes serб banido!", Nome); ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "Login", String, "Logar", "Cancelar"); Erro[playerid]++; if(Erro[playerid] == 5) { SendClientMessage(playerid, -1, "Sua conta estб banida por errar 5 vezes a sua senha!"); Ban(playerid); return 1; } } return 1; } else { SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo quis se logar, por este motivo serб Kickado"); Kick(playerid); return 1; } }
Код:
stock SalvarPlayer(playerid) { new Float:Vida; new Float:Colete; GetPlayerHealth(playerid, Vida); GetPlayerArmour(playerid, Colete); new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[50]; format(String, sizeof(String), Contas, Nome); DOF2_SetInt(String,"Level", GetPlayerScore(playerid)); DOF2_SetInt(String,"Admin", DadosPlayer[playerid][Admin]); DOF2_SetInt(String,"Skin", DadosPlayer[playerid][Sexo]); DOF2_SetInt(String,"Sexo", DadosPlayer[playerid][Skin]); DOF2_SetInt(String,"Dinheiro", GetPlayerMoney(playerid)); DOF2_SetFloat(String,"Vida", Vida); DOF2_SetFloat(String,"Colete", Colete); DOF2_SetInt(String,"Matou", DadosPlayer[playerid][Matou]); DOF2_SetInt(String,"Morreu", DadosPlayer[playerid][Morreu]); DOF2_SaveFile(); return 1; } stock SetarPlayer(playerid) { new Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome)); new String[50]; format(String, sizeof(String), Contas, Nome); DadosPlayer[playerid][Level] = DOF2_GetInt(String, "Level"); DadosPlayer[playerid][Admin] = DOF2_GetInt(String,"Admin"); DadosPlayer[playerid][Skin] = DOF2_GetInt(String,"Skin"); DadosPlayer[playerid][Sexo] = DOF2_GetInt(String,"Sexo"); GivePlayerMoney(playerid, DOF2_GetInt(String,"Dinheiro")); SetPlayerHealth(playerid, DOF2_GetInt(String,"Vida")); SetPlayerArmour(playerid, DOF2_GetInt(String,"Colete")); DadosPlayer[playerid][Matou] = DOF2_GetInt(String, "Matou"); DadosPlayer[playerid][Morreu] = DOF2_GetInt(String, "Morreu"); SetPlayerScore(playerid, DadosPlayer[playerid][Level]); if(DadosPlayer[playerid][Level] == 0) DadosPlayer[playerid][Level] = 1, SetPlayerScore(playerid, DadosPlayer[playerid][Level]); return 1; }
Espero ajuda