15.07.2014, 19:09
Codigo do dialog:
Codigo da funзгo que deleta o registro:
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1){
if(response == 1){
if(!strlen(inputtext)){
SendClientMessage(playerid, 0xecf0f1AA, "Digite um codigo para ativar!");
return 1;
}
format(inputtext2[playerid],128, "%s", inputtext);
format(query, sizeof(query), "SELECT * FROM `codigo` WHERE `code` = '%s'", inputtext);
mysql_tquery(MySQL, query, "ativarMoedas", "d", playerid);
SendClientMessage(playerid, 1, inputtext2[playerid]);
return 1;
}
return 1;
}
return 1;
}
PHP код:
forward ativarMoedas(playerid);
public ativarMoedas(playerid)
{
if(cache_num_rows() == 1)
{
new dest[128];
new txt[128];
cache_get_field_content(0, "quantia", dest);
format(txt, sizeof(txt), "Foram ativadas '%s' Moedas verdes em sua conta!", dest);
SendClientMessage(playerid, 0xecf0f1AA, txt);
return 1;
} else {
SendClientMessage(playerid, 0xecf0f1AA, "Nenhuma MV encontrada");
return 1;
}
format(query, sizeof(query), "DELETE FROM `codigo` WHERE `code` ='%s'", inputtext2[playerid]);
mysql_query(MySQL, query);
return 1;
}