Problem Show All row in dialog list
#1

I want convert mysql plugin R5 to R39, but i have problem.
When i want to show all row in my dialog list. But only one row that can show in my dialog list.

My code like this.
Код:
public OnPlayerRequestClass(playerid)
{
    SetSpawnInfo(playerid, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // Jurus jitu untuk spawn
    TogglePlayerSpectating(playerid, true);
    SetTimerEx("ShowDialog", 100, 0, "i", playerid);
    return 1;
}

forward ShowDialog(playerid);
public ShowDialog(playerid)
{
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    mysql_format(mysql, query, sizeof(query), "SELECT * FROM `playerchar` WHERE `charname` = '%e' || `username` = '%e' LIMIT 1", pName, pName);
    mysql_tquery(mysql, query, "Dialog", "d", playerid);
    return 1;
}

forward Dialog(playerid);
public Dialog(playerid)
{
    SetTimerEx("LoginTimer", 60000, false, "i", playerid);
    new rows = cache_num_rows();
    if(!rows)
    {
        ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_MSGBOX, "OPS...!","Kamu {FF0000}BELUM TERDAFTAR.","Quit","");
    }
    if(rows == 1)
    {
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    	cache_get_field_content(0, "username", PlayerInfo[playerid][uName], mysql, 12);
    	if(!strcmp(PlayerInfo[playerid][uName], pName, true))
	{
             for(new i=0; i < cache_get_row_count(); ++i)
	     {
          	  new charlist[80], charname[24];
		  cache_get_field_content(0, "charname", charname, mysql, 24);
		  format(charlist, sizeof(charlist), "%s\n%s", charlist,charname);
		  ShowPlayerDialog(playerid, 15555, DIALOG_STYLE_LIST, "Pilih Karakter Kamu!",charlist,"PILIH","BATAL");
	     }
	 }
  	 else
	 {
		cache_get_field_content(0, "password", PlayerInfo[playerid][pPass], mysql, 129);
      		ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_PASSWORD, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!","Login","Cancel");
	 }
     }
     return 1;
}

forward LoginTimer(playerid);
public LoginTimer(playerid)
{
	if(PlayerLogged[playerid] == 0)
	{
	    Kick(playerid);
	}
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)