18.01.2014, 04:25
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid){
case DIALOG01: {
new query[1024], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(query, sizeof(query), "SELECT * FROM `contas` WERE `usuario`= '%s' AND `senha` = %s", name, inputtext);
mysql_function_query(mysql, query, true, "q_verifyPassword", "d", "playerid");
}
case DIALOG02:{
if(strlen(inputtext)<2){
ShowPlayerDialog(playerid, DIALOG02,DIALOG_STYLE_PASSWORD, "Seja bem vindo","Digite uma senha","Registrar","Cancelar");
}else{
new query[1024], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(query, sizeof(query), "INSERT INTO `contas` (usuario, senha) VALUES ('%s','%s')", name, inputtext);
mysql_function_query(mysql, query, false,"", "");
SetSpawnInfo(playerid, 0, 0, 1958.3783, 1343.1572, 15.3746, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
}
return 1;
}
forward q_verifyPassword(playerid);
public q_verifyPassword(playerid){
new rows, fields;
cache_get_data(rows, fields);
if (rows){
SetSpawnInfo(playerid, 0, 0, 1958.3783, 1343.1572, 15.3746, 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG01,DIALOG_STYLE_PASSWORD, "Seja bem vindo 1 novamente","Olб Novamente, digite sua senha\n\nSenha Invalida","Logar","");
return 1;
}
}
criar a conta cria tudo normalzin zzzzzzz>><<
coloco qualquer senha e n da em nada tambem