29.11.2014, 13:45
Hello everyone !
Recently I started to learn how SQLite work and I've tried to make a database using it, but I have some problems with the Load function
Here it's the code:
And I want to put this
inside this function
Recently I started to learn how SQLite work and I've tried to make a database using it, but I have some problems with the Load function
Here it's the code:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new DBResult:res,ip[16];
GetPlayerIp(playerid,ip,sizeof(ip));
switch(dialogid)
{
case 1: // Register
{
if(response)
{
format(str,sizeof(str),"SELECT * FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE AND `PASSWORD` = '%s'",Escape(GetName(playerid)),Escape(inputtext));
res=db_query(users,str);
/*if(db_num_rows(res))
{
db_get_field_assoc(res,"LEVEL",field,30);
SetPlayerScore(playerid,strval(field));
SendClientMessage(playerid,0x000000ff,"You logged in !");
}*/
else ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Please enter your password","Login","Exit");
db_free_result(res);
}
else return Kick(playerid);
}
pawn Код:
if(db_num_rows(res))
{
db_get_field_assoc(res,"LEVEL",field,30);
SetPlayerScore(playerid,strval(field));
SendClientMessage(playerid,0x000000ff,"You logged in !");
}
pawn Код:
public Load(playerid)
{
return 1;
}