[Ajuda] Erro na variбvel DOF2_GetString
#1

Olб para vocк!
Estou precisando de ajuda para solucionar uma coisa que estб a martelar minha cabeзa hб trкs dias.
Eu estou criando um sistema de registro/login , busquei no fуrum e achei um tуpico bastante interessante no qual um usuбrio ensinava a criar o mesmo utilizando DOF2. O ъnico ponto negativo para mim foi que o mesmo sу aceitava senhas em nъmeros. Entгo, comecei a fazer alteraзхes em meu cуdigo para adaptar o mesmo.

Como muitos de vocкs sabem, o GetInt й utilizado para armazenar nъmeros inteiros, apenas. E como minha intensгo era substituir tal mйtodo, tive que utilizar o GetString. Finalizando, o cуdigo todo ficou da seguinte forma:

Quote:

#include <a_samp>
#include <DOF2>


//defines
#define cinza 0x708090FF
#define verde 0x228B22FF
#define laranja 0xFF4500FF
#define azul 0x1874CDAA
#define vermelho 0xFF0000AA

#define DIALOG_REG 1
#define DIALOG_LOG 2

//forwards
forward kikar(playerid);
forward hora(playerid);
forward msgon(playerid);
forward registrando(playerid);

//enums
enum Informacoes
{
pSenha,
pDinheiro,
pHabTerrestre,
pHabAquatica,
pHabAerea,
pExp,
pLevel,
pCel,
pOculos,
pBone,
pVip,
pMesesVip,
pSaldoBanco,
pMultas,
pVMultas,
pRelogio,
pProcurado,
pEstrelasProcurado,
pAvisos,
pProf,
pSkin,
pPreso,
pTempoPreso,
pMotivoPreso,
pQuemPrendeu,
pBanido,
pMotivoBanido,
pFome,
pSede,
pSono,
pVida,
pPosicao,
pCapacete,
pIp,
pHelper,
pAdmin,
pNovato
}

// news
new Text:Textdraw0;
new Text:Textdraw1;
new Player[MAX_PLAYERS][Informacoes];
new Logado[MAX_PLAYER_NAME] = 0;


main()
{
print("\n----------------------------------");
print("GM carregado com suceso.");
print("----------------------------------\n");
}

public OnGameModeInit()
{
SendRconCommand("hostname Brasil Vida Real ® | RPG SERVER | #BrasilPortugal");
SendRconCommand("mapname Brasil Vida Real");
SendRconCommand("changemode Brasil - BVR RPG v1.0.0");
SendRconCommand("weburl www.mathservers.com.br");
SetGameModeText("Brasil - BVR RPG v1.0.0");
SendRconCommand("language Portuguкs - Brasil");
SetWeather(14);
Textdraw0 = TextDrawCreate(491.000000, 129.000000, "00:00:00");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
Textdraw1 = TextDrawCreate(489.000000, 115.000000, "00/00/00");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
SetTimer("hora",1000,1);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerFacingAngle(playerid, 180);
SetPlayerPos(playerid, -2624.4458, 1421.1406, 24.0000);
SetPlayerCameraPos(playerid, -2620.6990, 1413.6143, 25.8391);
SetPlayerCameraLookAt(playerid, -2621.2310, 1414.4666, 25.8341);
return 1;
}

public OnPlayerConnect(playerid)
{
AddPlayerClass(154, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
PlayAudioStreamForPlayer(playerid, "http://habeta.com.br/preview.mp3");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid, azul, "| INFO | Aguarde... carregando os dados!");
SetPlayerFacingAngle(playerid, 180);
SetPlayerPos(playerid, -2624.4458, 1421.1406, 24.0000);
SetPlayerCameraPos(playerid, -2620.6990, 1413.6143, 25.8391);
SetPlayerCameraLookAt(playerid, -2621.2310, 1414.4666, 25.8341);
AddPlayerClass(154, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
Logado[playerid] = 0;
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetTimer("msgon", 1500, false);
new arquivo[40], aname[MAX_PLAYER_NAME], str[156], str2[156];
GetPlayerName(playerid, aname, 25);
format(arquivo, sizeof(arquivo), "Contas/%s.ini", aname);
format(str, sizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:", aname);
format(str2, sizeof(str2), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {FF4500}Nгo registrada\n\n{FFFFFF}Digite uma senha:", aname);
if(DOF2_FileExists(arquivo))
{
ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "{FF0000}Conta", str, "Logar", "Sair");
}else{
ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "{FF0000}Registro", str2, "Registrar", "Sair");
AddPlayerClass(154, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

}

return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
(Logado[playerid] = 0);
DOF2_Exit();
return 1;
}

public OnPlayerSpawn(playerid)
{
if(Logado[playerid] == 1)
{
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid, -1, "| CONTA | Logado com sucesso!");
StopAudioStreamForPlayer(playerid);
}else{
SendClientMessage(playerid, -1, "{FF0000}| LOGIN | Vocк nгo fez login e tentou burlar o sistema.");
SetTimer("kikar", 250, false);

}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{

return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
new str[250], aname[20];
GetPlayerName(playerid, aname, sizeof(aname));
format(str, sizeof(str), "%s: [%d] %s",aname, playerid, text);
if(Logado[playerid] == 1)
{
SendClientMessageToAll(-1, str);
}else{
SendClientMessage(playerid, laranja, "| ERRO | Faзa o login antes de conversar.");
}
return 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(Logado[playerid] == 1)
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return SendClientMessage(playerid, laranja, "| ERRO | Digite: /Ajuda Level, Salario, Comandos, Contato, Casa, Empresa, Carro, Loteria, Concessionaria, Mercadoria");
}else{
SendClientMessage(playerid, laranja, "| ERRO | Logue antes de usar os comandos.");
return 1;
}

}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new arquivo[40], aname[MAX_PLAYER_NAME], str[156], str2[156], ip[30];
GetPlayerName(playerid, aname, 25);
format(arquivo, sizeof(arquivo), "Contas/%s.ini", aname);
format(str, sizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:", aname);
format(str2, sizeof(str2), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {FF4500}Nгo registrada\n\n{FFFFFF}Digite uma senha:", aname);
if(dialogid == DIALOG_REG)
{
AddPlayerClass(154, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SetPlayerFacingAngle(playerid, 180);
SetPlayerPos(playerid, -2624.4458, 1421.1406, 24.0000);
SetPlayerCameraPos(playerid, -2620.6990, 1413.6143, 25.8391);
SetPlayerCameraLookAt(playerid, -2621.2310, 1414.4666, 25.8341);
if(strlen(inputtext) < 5){
SendClientMessage(playerid, laranja, "| ERRO | Vocк digitou uma senha muito pequena! (Ela precisa ter entre 5 e 15 caracteres)");
ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "{FF0000}Registro", str2, "Registrar", "Sair");

}
if(strlen(inputtext) > 15){
SendClientMessage(playerid, laranja, "| ERRO | Vocк digitou uma senha muito grande! (Ela precisa ter entre 5 e 15 caracteres)");
ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "{FF0000}Registro", str2, "Registrar", "Sair");

}

if(!response)
{
SendClientMessage(playerid, -1, "{FF0000}| REGISTRO | Vocк cancelou o registro e por este motivo foi kikado.");
SetTimer("kikar", 250, false);
return 1;
}

else
{
GetPlayerIp(playerid, Player[playerid][pIp], 156);
format(ip, sizeof(ip), "%i");
SendClientMessage(playerid, -1, "{32CD32}| INFO | {1874CD}Efetuando registro...");
GameTextForPlayer(playerid, "~b~Carregando...", 5000, 5);
DOF2_CreateFile(arquivo);
DOF2_SetString(arquivo, "Senha", (inputtext));
DOF2_SetInt(arquivo, "Dinheiro", 560);
DOF2_SetInt(arquivo, "HabilitacaoTerrestre", 0);
DOF2_SetInt(arquivo, "HabilitacaoAquatica", 0);
DOF2_SetInt(arquivo, "HabilitacaoAerea", 0);
DOF2_SetInt(arquivo, "Experiencia", 0);
DOF2_SetInt(arquivo, "Level", 0);
DOF2_SetInt(arquivo, "Celular", 0);
DOF2_SetInt(arquivo, "Oculos", 0);
DOF2_SetInt(arquivo, "Bone", 0);
DOF2_SetInt(arquivo, "Vip", 0);
DOF2_SetInt(arquivo, "MesesVip", 0);
DOF2_SetInt(arquivo, "Saldo", 0);
DOF2_SetInt(arquivo, "Multas", 0);
DOF2_SetInt(arquivo, "ValorMultas", 0);
DOF2_SetInt(arquivo, "Relogio", 0);
DOF2_SetInt(arquivo, "Procurado", 0);
DOF2_SetInt(arquivo, "EstrelasProcurado", 0);
DOF2_SetInt(arquivo, "Avisos", 0);
DOF2_SetInt(arquivo, "Profissao", 0);
DOF2_SetInt(arquivo, "Skin", 154);
DOF2_SetInt(arquivo, "Preso", 0);
DOF2_SetInt(arquivo, "TempoPreso", 0);
DOF2_SetInt(arquivo, "MotivoPreso", 0);
DOF2_SetInt(arquivo, "QuemPrendeu", 0);
DOF2_SetInt(arquivo, "Banido", 0);
DOF2_SetInt(arquivo, "MotivoBan", 0);
DOF2_SetInt(arquivo, "Fome", 100);
DOF2_SetInt(arquivo, "Sede", 100);
DOF2_SetInt(arquivo, "Sono", 100);
DOF2_SetInt(arquivo, "Vida", 100);
DOF2_SetInt(arquivo, "Capacete", 0);
DOF2_SetString(arquivo, "Ip", Player[playerid][pIp]);
DOF2_SetInt(arquivo, "Helper", 0);
DOF2_SetInt(arquivo, "Admin", 0);
DOF2_SetInt(arquivo, "Novato", 1);
DOF2_SetInt(arquivo, "Posicao", 0);
SetTimer("registrando", 5000, false);
return 1;

}

}

if(dialogid == DIALOG_LOG)
{
AddPlayerClass(154, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
SetPlayerFacingAngle(playerid, 180);
SetPlayerPos(playerid, -2624.4458, 1421.1406, 24.0000);
SetPlayerCameraPos(playerid, -2620.6990, 1413.6143, 25.8391);
SetPlayerCameraLookAt(playerid, -2621.2310, 1414.4666, 25.8341);
if(strlen(inputtext) < 5)
{
ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "{FF0000}Conta", str, "Logar", "Sair");
SendClientMessage(playerid, laranja, "| ERRO | Senha invбlida! (Possui menos de 5 caracteres)");
return 1;
}
if(strlen(inputtext) > 15)
{
ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "{FF0000}Conta", str, "Logar", "Sair");
SendClientMessage(playerid, laranja, "| ERRO | Senha invбlida! (Possui mais de 15 caracteres)");
return 1;
}
if(!response)
{
SendClientMessage(playerid, -1, "{FF0000}| LOGIN | Vocк cancelou o login, por isso foi kikado!");
SetTimer("kikar", 250, false);
return 1;
}else{
if(Player[playerid][pSenha] == DOF2_GetString(arquivo, "Senha", strlen(inputtext)))
{
SendClientMessage(playerid, -1, "{32CD32}| INFO | {FFFFFF}Vocк entrou na sua conta com sucesso! Clique em spawn para jogar.");
GameTextForPlayer(playerid, "~b~CLIQUE EM SPAWN~w~~d~", 5000, 5);
(Logado[playerid] = 1);
}else{
SendClientMessage(playerid, vermelho, "| LOGIN | Senha incorreta!");
SetTimer("kikar", 250, false);
}

}
}
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

public hora(playerid)
{
new str[128], str2[128], year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour,minute,second);
if(hour == 21) {SetWorldTime(00);}
if(hour == 22) {SetWorldTime(00);}
if(hour == 23) {SetWorldTime(00);}
if(hour == 00) {SetWorldTime(00);}
if(hour == 01) {SetWorldTime(01);}
if(hour == 02) {SetWorldTime(02);}
if(hour == 03) {SetWorldTime(03);}
if(hour == 04) {SetWorldTime(04);}
if(hour == 05) {SetWorldTime(05);}
if(hour == 06) {SetWorldTime(06);}
if(hour == 07) {SetWorldTime(07);}
if(hour == 08) {SetWorldTime(08);}
if(hour == 09) {SetWorldTime(09);}
if(hour == 10) {SetWorldTime(10);}
if(hour == 11) {SetWorldTime(11);}
if(hour == 12) {SetWorldTime(12);}
if(hour == 13) {SetWorldTime(13);}
if(hour == 14) {SetWorldTime(14);}
if(hour == 15) {SetWorldTime(15);}
if(hour == 16) {SetWorldTime(19);}
if(hour == 17) {SetWorldTime(20);}
if(hour == 18) {SetWorldTime(20);}
if(hour == 19) {SetWorldTime(21);}
if(hour == 20) {SetWorldTime(22);}
new mes[12];
if(month == 1) { mes = "janeiro"; }
else if(month == 2) {mes = "fevereiro";}
else if(month == 3) {mes = "marзo";}
else if(month == 4) {mes = "abril";}
else if(month == 5) {mes = "maio";}
else if(month == 6) {mes = "junho";}
else if(month == 7) {mes = "julho";}
else if(month == 8) {mes = "agosto";}
else if(month == 9) {mes = "setembro";}
else if(month == 10) {mes = "outubro";}
else if(month == 11) {mes = "novembro";}
else if(month == 12) {mes= "dezembro";}
format(str, sizeof(str), "%d de %s de %d", day, mes,year);
TextDrawSetString(Text:Textdraw0, str);
format(str2, sizeof(str2), "%d:0%d", hour, minute);
TextDrawSetString(Text:Textdraw1, str2);
}

public msgon(playerid)
{
SetPlayerFacingAngle(playerid, 180);
SetPlayerPos(playerid, -2624.4458, 1421.1406, 24.0000);
SetPlayerCameraPos(playerid, -2620.6990, 1413.6143, 25.8391);
SetPlayerCameraLookAt(playerid, -2621.2310, 1414.4666, 25.8341);
new str[156], aname[20];
GetPlayerName(playerid, aname, sizeof(aname));
format(str, sizeof(str), "» Bem vindo(a) ao servidor Brasil Vida Real,'{228B22}%s{FFFFFF}' ", aname);
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid,-1, " ");
SendClientMessage(playerid, cinza, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~");
SendClientMessage(playerid, -1, str);
SendClientMessage(playerid, -1, "» Para ver os comandos do servidor Digite: /Ajuda Comandos");
SendClientMessage(playerid, cinza, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~");
return 1;
}

public kikar(playerid)
{
Kick(playerid);
return 1;
}

public registrando(playerid)
{
new str[156], aname[25];
GetPlayerName(playerid, aname, 25);
format(str, sizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:", aname);
SendClientMessage(playerid, -1, "{32CD32}| INFO | {FFFFFF}Conta registrada com sucesso! Logue para poder jogar.");
ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "{FF0000}Conta", str, "Logar", "Sair");
return 1;
}

Porйm, o mesmo apontou o seguinte erro na hora de compilar:
Quote:

C:\Users\MATHEUS\Desktop\Samp\gamemodes\rpg.pwn(47 6) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

A linha do erro й esta:
Quote:

if(Player[playerid][pSenha] == DOF2_GetString(arquivo, "Senha", strlen(inputtext)))
{
SendClientMessage(playerid, -1, "{32CD32}| INFO | {FFFFFF}Vocк entrou na sua conta com sucesso! Clique em spawn para jogar.");
GameTextForPlayer(playerid, "~b~CLIQUE EM SPAWN~w~~d~", 5000, 5);
(Logado[playerid] = 1);
}else{
SendClientMessage(playerid, vermelho, "| LOGIN | Senha incorreta!");
SetTimer("kikar", 250, false);
}

Nгo mais como solucionar este problema, aguardo sua resposta aqui abaixo, serei muito grato!
Atenciosamente,
Math666.
Reply
#2

PHP код:
if(Player[playerid][pSenha] == DOF2_GetString(arquivo"Senha"strlen(inputtext)))
{
SendClientMessage(playerid, -1"{32CD32}| INFO | {FFFFFF}Vocк entrou na sua conta com sucesso! Clique em spawn para jogar.");
GameTextForPlayer(playerid"~b~CLIQUE EM SPAWN~w~~d~"50005);
Logado[playerid] = 1;
}else{
SendClientMessage(playeridvermelho"| LOGIN | Senha incorreta!");
SetTimer("kikar"250false);

tenta
Reply
#3

Nгo funcionou amigo, continua o mesmo erro.
Reply
#4

MANDA A LINHA EXATA DO ERRO
Reply
#5

PHP код:
format(arquivosizeof(arquivo), "contas/%s.ini"aname);
if(!
strcmp(inputtext,DOF2_GetString(arquivo,"Senha"),false))
{
    
SendClientMessage(playerid, -1"{32CD32}| INFO | {FFFFFF}Vocк entrou na sua conta com sucesso! Clique em spawn para jogar.");
    
GameTextForPlayer(playerid"~b~CLIQUE EM SPAWN~w~~d~"50005);
    
Logado[playerid] = 1;
    return 
1;
}else{
    
SendClientMessage(playeridvermelho"| LOGIN | Senha incorreta!");
    
SetTimer("kikar"250false);
    return 
1;

Isso da pra melhorar simplificar
PHP код:
if(strlen(inputtext) < 5)
{
    
    
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
    
SendClientMessage(playeridlaranja"| ERRO | Senha invбlida! (Possui menos de 5 caracteres)");
    return 
1;
}
if(
strlen(inputtext) > 15)
{
    
    
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
    
SendClientMessage(playeridlaranja"| ERRO | Senha invбlida! (Possui mais de 15 caracteres)");
    return 
1;

Simplificado, || Significa "Ou"
PHP код:
// se menor que 5        ou        maior que 16    ou nao colocou nada
if(strlen(inputtext) < || strlen(inputtext) > 16 ||!strlen(inputtext))
{
    
    
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
    
SendClientMessage(playeridlaranja"| ERRO | senha invalida");
    return 
1;


Seu gm estava com alguns erros, tudo que abre ( tem que fechar ),

PHP код:
#include <a_samp>
#include <DOF2>
//defines
#define cinza 0x708090FF
#define verde 0x228B22FF
#define laranja 0xFF4500FF
#define azul 0x1874CDAA
#define vermelho 0xFF0000AA
#define DIALOG_REG 1
#define DIALOG_LOG 2
//forwards
forward kikar(playerid);
forward hora(playerid);
forward msgon(playerid);
forward registrando(playerid);
//enums
enum Informacoes
{
    
pSenha,
    
pDinheiro,
    
pHabTerrestre,
    
pHabAquatica,
    
pHabAerea,
    
pExp,
    
pLevel,
    
pCel,
    
pOculos,
    
pBone,
    
pVip,
    
pMesesVip,
    
pSaldoBanco,
    
pMultas,
    
pVMultas,
    
pRelogio,
    
pProcurado,
    
pEstrelasProcurado,
    
pAvisos,
    
pProf,
    
pSkin,
    
pPreso,
    
pTempoPreso,
    
pMotivoPreso,
    
pQuemPrendeu,
    
pBanido,
    
pMotivoBanido,
    
pFome,
    
pSede,
    
pSono,
    
pVida,
    
pPosicao,
    
pCapacete,
    
pIp,
    
pHelper,
    
pAdmin,
    
pNovato
}
// news
new Text:Textdraw0;
new 
Text:Textdraw1;
new 
Player[MAX_PLAYERS][Informacoes];
new 
Logado[MAX_PLAYER_NAME] = 0;
main()
{
    print(
"\n----------------------------------");
    print(
"GM carregado com suceso.");
    print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
    
SendRconCommand("hostname Brasil Vida Real ® | RPG SERVER | #BrasilPortugal");
    
SendRconCommand("mapname Brasil Vida Real");
    
SendRconCommand("changemode Brasil - BVR RPG v1.0.0");
    
SendRconCommand("weburl www.mathservers.com.br");
    
SetGameModeText("Brasil - BVR RPG v1.0.0");
    
SendRconCommand("language Portuguкs - Brasil");
    
SetWeather(14);
    
Textdraw0 TextDrawCreate(491.000000129.000000"00:00:00");
    
TextDrawBackgroundColor(Textdraw0255);
    
TextDrawFont(Textdraw01);
    
TextDrawLetterSize(Textdraw00.5000001.000000);
    
TextDrawColor(Textdraw0, -1);
    
TextDrawSetOutline(Textdraw00);
    
TextDrawSetProportional(Textdraw01);
    
TextDrawSetShadow(Textdraw01);
    
Textdraw1 TextDrawCreate(489.000000115.000000"00/00/00");
    
TextDrawBackgroundColor(Textdraw1255);
    
TextDrawFont(Textdraw11);
    
TextDrawLetterSize(Textdraw10.5000001.000000);
    
TextDrawColor(Textdraw1, -1);
    
TextDrawSetOutline(Textdraw10);
    
TextDrawSetProportional(Textdraw11);
    
TextDrawSetShadow(Textdraw11);
    
SetTimer("hora",1000,1);
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerFacingAngle(playerid180);
    
SetPlayerPos(playerid, -2624.44581421.140624.0000);
    
SetPlayerCameraPos(playerid, -2620.69901413.614325.8391);
    
SetPlayerCameraLookAt(playerid, -2621.23101414.466625.8341);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
AddPlayerClass(1541958.37831343.157215.3746269.1425000000);
    
PlayAudioStreamForPlayer(playerid"http://habeta.com.br/preview.mp3");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playeridazul"| INFO | Aguarde... carregando os dados!");
    
SetPlayerFacingAngle(playerid180);
    
SetPlayerPos(playerid, -2624.44581421.140624.0000);
    
SetPlayerCameraPos(playerid, -2620.69901413.614325.8391);
    
SetPlayerCameraLookAt(playerid, -2621.23101414.466625.8341);
    
AddPlayerClass(1541958.37831343.157215.3746269.1425000000);
    
Logado[playerid] = 0;
    
TextDrawShowForPlayer(playeridTextdraw0);
    
TextDrawShowForPlayer(playeridTextdraw1);
    
SetPlayerColor(playerid0xFFFFFFFF);
    
SetTimer("msgon"1500false);
    new 
arquivo[40], aname[MAX_PLAYER_NAME], str[156], str2[156];
    
GetPlayerName(playeridaname25);
    
format(arquivosizeof(arquivo), "Contas/%s.ini"aname);
    
format(strsizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:"aname);
    
format(str2sizeof(str2), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {FF4500}Nгo registrada\n\n{FFFFFF}Digite uma senha:"aname);
    if(
DOF2_FileExists(arquivo))
    {
        
        
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
    }else{
        
ShowPlayerDialog(playeridDIALOG_REGDIALOG_STYLE_PASSWORD"{FF0000}Registro"str2"Registrar""Sair");
        
AddPlayerClass(1541958.37831343.157215.3746269.1425000000);
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    (
Logado[playerid] = 0);
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(
Logado[playerid] == 1)
    {
        
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid,-1" ");
        
SendClientMessage(playerid, -1"| CONTA | Logado com sucesso!");
        
StopAudioStreamForPlayer(playerid);
    }else{
        
SendClientMessage(playerid, -1"{FF0000}| LOGIN | Vocк nгo fez login e tentou burlar o sistema.");
        
SetTimer("kikar"250false);
    }
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    new 
str[250], aname[20];
    
GetPlayerName(playeridanamesizeof(aname));
    
format(strsizeof(str), "%s: [%d] %s",anameplayeridtext);
    if(
Logado[playerid] == 1)
    {
        
        
SendClientMessageToAll(-1str);
    }else{
        
SendClientMessage(playeridlaranja"| ERRO | Faзa o login antes de conversar.");
    }
    return 
0;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
Logado[playerid] == 1)
    {
        
        if (
strcmp("/mycommand"cmdtexttrue10) == 0)
        {
            
            
// Do something here
            
return 1;
        }
        return 
SendClientMessage(playeridlaranja"| ERRO | Digite: /Ajuda Level, Salario, Comandos, Contato, Casa, Empresa, Carro, Loteria, Concessionaria, Mercadoria");
    }else{
        
SendClientMessage(playeridlaranja"| ERRO | Logue antes de usar os comandos.");
        return 
1;
    }
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnRconCommand(cmd[])
{
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}
public 
OnObjectMoved(objectid)
{
    return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
arquivo[40], aname[MAX_PLAYER_NAME], str[156], str2[156], ip[30];
    
GetPlayerName(playeridaname25);
    
format(arquivosizeof(arquivo), "Contas/%s.ini"aname);
    
format(strsizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:"aname);
    
format(str2sizeof(str2), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {FF4500}Nгo registrada\n\n{FFFFFF}Digite uma senha:"aname);
    if(
dialogid == DIALOG_REG)
    {
        
        
AddPlayerClass(1541958.37831343.157215.3746269.1425000000);
        
SetPlayerFacingAngle(playerid180);
        
SetPlayerPos(playerid, -2624.44581421.140624.0000);
        
SetPlayerCameraPos(playerid, -2620.69901413.614325.8391);
        
SetPlayerCameraLookAt(playerid, -2621.23101414.466625.8341);
        if(
strlen(inputtext) < 5){
            
SendClientMessage(playeridlaranja"| ERRO | Vocк digitou uma senha muito pequena! (Ela precisa ter entre 5 e 15 caracteres)");
            
ShowPlayerDialog(playeridDIALOG_REGDIALOG_STYLE_PASSWORD"{FF0000}Registro"str2"Registrar""Sair");
        }
        if(
strlen(inputtext) > 15){
            
SendClientMessage(playeridlaranja"| ERRO | Vocк digitou uma senha muito grande! (Ela precisa ter entre 5 e 15 caracteres)");
            
ShowPlayerDialog(playeridDIALOG_REGDIALOG_STYLE_PASSWORD"{FF0000}Registro"str2"Registrar""Sair");
        }
        if(!
response)
        {
            
            
SendClientMessage(playerid, -1"{FF0000}| REGISTRO | Vocк cancelou o registro e por este motivo foi kikado.");
            
SetTimer("kikar"250false);
            return 
1;
        }
        else
        {
            
            
GetPlayerIp(playeridPlayer[playerid][pIp], 156);
            
format(ipsizeof(ip), "%i");
            
SendClientMessage(playerid, -1"{32CD32}| INFO | {1874CD}Efetuando registro...");
            
GameTextForPlayer(playerid"~b~Carregando..."50005);
            
DOF2_CreateFile(arquivo);
            
DOF2_SetString(arquivo"Senha", (inputtext));
            
DOF2_SetInt(arquivo"Dinheiro"560);
            
DOF2_SetInt(arquivo"HabilitacaoTerrestre"0);
            
DOF2_SetInt(arquivo"HabilitacaoAquatica"0);
            
DOF2_SetInt(arquivo"HabilitacaoAerea"0);
            
DOF2_SetInt(arquivo"Experiencia"0);
            
DOF2_SetInt(arquivo"Level"0);
            
DOF2_SetInt(arquivo"Celular"0);
            
DOF2_SetInt(arquivo"Oculos"0);
            
DOF2_SetInt(arquivo"Bone"0);
            
DOF2_SetInt(arquivo"Vip"0);
            
DOF2_SetInt(arquivo"MesesVip"0);
            
DOF2_SetInt(arquivo"Saldo"0);
            
DOF2_SetInt(arquivo"Multas"0);
            
DOF2_SetInt(arquivo"ValorMultas"0);
            
DOF2_SetInt(arquivo"Relogio"0);
            
DOF2_SetInt(arquivo"Procurado"0);
            
DOF2_SetInt(arquivo"EstrelasProcurado"0);
            
DOF2_SetInt(arquivo"Avisos"0);
            
DOF2_SetInt(arquivo"Profissao"0);
            
DOF2_SetInt(arquivo"Skin"154);
            
DOF2_SetInt(arquivo"Preso"0);
            
DOF2_SetInt(arquivo"TempoPreso"0);
            
DOF2_SetInt(arquivo"MotivoPreso"0);
            
DOF2_SetInt(arquivo"QuemPrendeu"0);
            
DOF2_SetInt(arquivo"Banido"0);
            
DOF2_SetInt(arquivo"MotivoBan"0);
            
DOF2_SetInt(arquivo"Fome"100);
            
DOF2_SetInt(arquivo"Sede"100);
            
DOF2_SetInt(arquivo"Sono"100);
            
DOF2_SetInt(arquivo"Vida"100);
            
DOF2_SetInt(arquivo"Capacete"0);
            
DOF2_SetString(arquivo"Ip"Player[playerid][pIp]);
            
DOF2_SetInt(arquivo"Helper"0);
            
DOF2_SetInt(arquivo"Admin"0);
            
DOF2_SetInt(arquivo"Novato"1);
            
DOF2_SetInt(arquivo"Posicao"0);
            
SetTimer("registrando"5000false);
            return 
1;
        }
    }
    if(
dialogid == DIALOG_LOG)
    {
        
        
AddPlayerClass(1541958.37831343.157215.3746269.1425000000);
        
SetPlayerFacingAngle(playerid180);
        
SetPlayerPos(playerid, -2624.44581421.140624.0000);
        
SetPlayerCameraPos(playerid, -2620.69901413.614325.8391);
        
SetPlayerCameraLookAt(playerid, -2621.23101414.466625.8341);
        if(
strlen(inputtext) < 5)
        {
            
            
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
            
SendClientMessage(playeridlaranja"| ERRO | Senha invбlida! (Possui menos de 5 caracteres)");
            return 
1;
        }
        if(
strlen(inputtext) > 15)
        {
            
            
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
            
SendClientMessage(playeridlaranja"| ERRO | Senha invбlida! (Possui mais de 15 caracteres)");
            return 
1;
        }
        if(!
response)
        {
            
            
SendClientMessage(playerid, -1"{FF0000}| LOGIN | Vocк cancelou o login, por isso foi kikado!");
            
SetTimer("kikar"250false);
            return 
1;
        }else{
            
format(arquivosizeof(arquivo), "contas/%s.ini"aname);
            if(!
strcmp(inputtext,DOF2_GetString(arquivo,"Senha"),false))
            {
                
                
SendClientMessage(playerid, -1"{32CD32}| INFO | {FFFFFF}Vocк entrou na sua conta com sucesso! Clique em spawn para jogar.");
                
GameTextForPlayer(playerid"~b~CLIQUE EM SPAWN~w~~d~"50005);
                
Logado[playerid] = 1;
                return 
1;
            }else{
                
SendClientMessage(playeridvermelho"| LOGIN | Senha incorreta!");
                
SetTimer("kikar"250false);
                return 
1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
public 
hora(playerid)
{
    new 
str[128], str2[128], yearmonthdayhourminutesecond;
    
getdate(yearmonthday);
    
gettime(hour,minute,second);
    if(
hour == 21) {SetWorldTime(00);}
    if(
hour == 22) {SetWorldTime(00);}
    if(
hour == 23) {SetWorldTime(00);}
    if(
hour == 00) {SetWorldTime(00);}
    if(
hour == 01) {SetWorldTime(01);}
    if(
hour == 02) {SetWorldTime(02);}
    if(
hour == 03) {SetWorldTime(03);}
    if(
hour == 04) {SetWorldTime(04);}
    if(
hour == 05) {SetWorldTime(05);}
    if(
hour == 06) {SetWorldTime(06);}
    if(
hour == 07) {SetWorldTime(07);}
    if(
hour == ){SetWorldTime(0);}
    if(
hour == 09) {SetWorldTime(09);}
    if(
hour == 10) {SetWorldTime(10);}
    if(
hour == 11) {SetWorldTime(11);}
    if(
hour == 12) {SetWorldTime(12);}
    if(
hour == 13) {SetWorldTime(13);}
    if(
hour == 14) {SetWorldTime(14);}
    if(
hour == 15) {SetWorldTime(15);}
    if(
hour == 16) {SetWorldTime(19);}
    if(
hour == 17) {SetWorldTime(20);}
    if(
hour == ){SetWorldTime(20);}
    if(
hour == 19) {SetWorldTime(21);}
    if(
hour == 20) {SetWorldTime(22);}
    new 
mes[12];
    if(
month == 1) { mes "janeiro"; }
    else if(
month == 2) {mes "fevereiro";}
    else if(
month == 3) {mes "marзo";}
    else if(
month == 4) {mes "abril";}
    else if(
month == 5) {mes "maio";}
    else if(
month == 6) {mes "junho";}
    else if(
month == 7) {mes "julho";}
    else if(
month == 8) {mes "agosto";}
    else if(
month == 9) {mes "setembro";}
    else if(
month == 10) {mes "outubro";}
    else if(
month == 11) {mes "novembro";}
    else if(
month == 12) {mes"dezembro";}
    
format(strsizeof(str), "%d de %s de %d"daymes,year);
    
TextDrawSetString(Text:Textdraw0str);
    
format(str2sizeof(str2), "%d:0%d"hourminute);
    
TextDrawSetString(Text:Textdraw1str2);
}
public 
msgon(playerid)
{
    
SetPlayerFacingAngle(playerid180);
    
SetPlayerPos(playerid, -2624.44581421.140624.0000);
    
SetPlayerCameraPos(playerid, -2620.69901413.614325.8391);
    
SetPlayerCameraLookAt(playerid, -2621.23101414.466625.8341);
    new 
str[156], aname[20];
    
GetPlayerName(playeridanamesizeof(aname));
    
format(strsizeof(str), "» Bem vindo(a) ao servidor Brasil Vida Real,'{228B22}%s{FFFFFF}' "aname);
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playerid,-1" ");
    
SendClientMessage(playeridcinza"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~");
    
SendClientMessage(playerid, -1str);
    
SendClientMessage(playerid, -1"» Para ver os comandos do servidor Digite: /Ajuda Comandos");
    
SendClientMessage(playeridcinza"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~");
    return 
1;
}
public 
kikar(playerid)
{
    
Kick(playerid);
    return 
1;
}
public 
registrando(playerid)
{
    new 
str[156], aname[25];
    
GetPlayerName(playeridaname25);
    
format(strsizeof(str), "{4169E1}Usuбrio: {FFFFFF}%s\n\n{FFFFFF}Conta: {32CD32}Registrada\n\n{FFFFFF}Informe sua senha:"aname);
    
SendClientMessage(playerid, -1"{32CD32}| INFO | {FFFFFF}Conta registrada com sucesso! Logue para poder jogar.");
    
ShowPlayerDialog(playeridDIALOG_LOGDIALOG_STYLE_PASSWORD"{FF0000}Conta"str"Logar""Sair");
    return 
1;

Reply
#6

Muito obrigado amigo! Isso passou-me por despercebido muitas vezes, tanto й que nem notei, funcionou perfeitamente. Grato por sua ajuda
Reply
#7

de 615 linhas totalmente horrнveis para 345 linhas, fora os bug nervoso que tinha '-'.

PHP код:
Retirei por causa dos membros do me grupo :
Reply
#8

Sou novo e estou tentando dar o meu melhor Obrigado pela boa vontade de resumir o cуdigo e corrigir os bugs, mas respeitadamente recusarei... Sei que no futuro haverб alguns bugs. Mas afinal, precisamos possuir pedras em nossos caminhos. E nunca pedir nada pronto. Enfim, agradeзo novamente, pela sua boa vontade
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)