este es el codigo miralo donde va exactamente en ondialog response o en onqueryfinish la verdad no entiendo eso..
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[256];
new pName[24], Query[256]; GetPlayerName(playerid, pName, 24);
switch(dialogid)
{
case LOGIN:
{
if(!response)
{
Kick(playerid);
}
if(strcmp(PlayerInfo[playerid][pPassword], inputtext, true, 128) == 0)
{
format(Query, sizeof(Query), "SELECT * FROM `usuarios` WHERE `Nombre` = '%s'", pName);
mysql_function_query(Conecction, Query, true, "OnQueryFinish", "ii", 1, playerid);
SetSpawnInfo(playerid,0,0,PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz],0,0,0,0,0,0,0);
SetPlayerHealth(playerid, PlayerInfo[playerid][pVida]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pChaleco]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
SpawnPlayer(playerid);
}
else
{
SendClientMessage(playerid, -1, "CONTRASEСA INCORRECTA");
Kick(playerid);
}
}
case REGISTRO:
{
if(!response)
{
SendClientMessage(playerid, -1, "Kicked");
Kick(playerid);
}
if(response)
{
if(!strlen(inputtext))
{
Kick(playerid);
}
new string2[128];
format(string2, sizeof(string2), "%s", inputtext); PlayerInfo[playerid][pPassword] = string2;
format(Query, sizeof(Query), "INSERT INTO `usuarios` (Nombre, Password) VALUES ('%s', '%s')",pName, PlayerInfo[playerid][pPassword]);
mysql_function_query(Conecction, Query, true, "OnQueryFinish", "ii", 0, playerid);
format(string, sizeof(string), "Has registrado el personaje %s en nuestro servidor.\n\nAhora inicia sesiуn", pName);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD,"Iniciar sesiуn",string,"Enviar","Salir");
}
}
}
return 1;
}
forward OnQueryFinish(resultid, extraid, ConnectionHandle);
public OnQueryFinish(resultid, extraid, ConnectionHandle)
{
new Rows, Field, string[256];
if(resultid != 0)
{
cache_get_data(Rows, Field);
}
switch(resultid)
{
case 1:
{
if(Rows == 1)
{
new content[20];
cache_get_field_content(0, "Password", PlayerInfo[extraid][pPassword]);
cache_get_field_content(0, "Score", content); PlayerInfo[extraid][pScore] = strval(content);
cache_get_field_content(0, "Vida", content); PlayerInfo[extraid][pVida] = floatstr(content);
cache_get_field_content(0, "Chaleco", content); PlayerInfo[extraid][pChaleco] = floatstr(content);
cache_get_field_content(0, "posX", content); PlayerInfo[extraid][pPosx] = floatstr(content);
cache_get_field_content(0, "posY", content); PlayerInfo[extraid][pPosy] = floatstr(content);
cache_get_field_content(0, "posZ", content); PlayerInfo[extraid][pPosz] = floatstr(content);
SetSpawnInfo(extraid,0,0, PlayerInfo[extraid][pPosx],PlayerInfo[extraid][pPosy],PlayerInfo[extraid][pPosz],0.0,0,0,0,0,0,0);
SetPlayerScore(extraid, PlayerInfo[extraid][pScore]);
SetPlayerArmour(extraid, PlayerInfo[extraid][pChaleco]);
}
else if(!Rows)
{
//
}
}
case 2:
{
if(Rows == 1)
{
new pName[24]; GetPlayerName(extraid, pName, 24);
cache_get_field_content(0, "Password", PlayerInfo[extraid][pPassword]);
format(string, sizeof(string), "El personaje %s estб registrado en la base de datos. Pon los datos para iniciar sesiуn:", pName);
ShowPlayerDialog(extraid, LOGIN, DIALOG_STYLE_PASSWORD,"Login",string,"Enviar","Salir");
}
else if(!Rows)
{
new pName[24]; GetPlayerName(extraid, pName, 24);
format(string, sizeof(string), "El jugador %s no estб registrado en el servidor, pon aquн la contraseсa para registrarlo:", pName);
ShowPlayerDialog(extraid, REGISTRO, DIALOG_STYLE_PASSWORD,"Registro:",string,"Enviar","Salir");
}
}
}
return 1;
}