Showing dynamic ShowPlayerDialog MySQL - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Showing dynamic ShowPlayerDialog MySQL (
/showthread.php?tid=613740)
Showing dynamic ShowPlayerDialog MySQL -
DavidLuango - 31.07.2016
Hello. I'm trying to make a command /factions which will show user all the factions in my database.
However, It doesn't seem to work for me.
PHP код:
CMD:factions(playerid,params[])
{
mysql_tquery(mysql, "SELECT * FROM `Factions` LIMIT "#MAX_FACTIONS"", "LoadFactionsIG", "");
return 1;
}
forward LoadFactionsIG();
public LoadFactionsIG()
{
new userstring[250];
new count = cache_get_row_count();
for (new i; i < count; i++)
{
format(userstring, sizeof(userstring), "%s \n",cache_get_field_content(i, "Name", Factions[i][Name]));
ShowPlayerDialog(i, 10, DIALOG_STYLE_MSGBOX, "Factions", userstring, "OK","");
}
printf("> %d factions have been loaded from the database.", count); // Prints out the information of how many factions created
return 1;
}
Do I have to use callback for such thing isn't there a simpler way to achieve what I want.
Re: Showing dynamic ShowPlayerDialog MySQL -
Stuntff - 31.07.2016
Код:
CMD:factions(playerid,params[]) return mysql_tquery(mysql, "SELECT `Name` FROM `Factions'", "LoadFactionsIG", "i",playerid);
forward LoadFactionsIG(playerid);
public LoadFactionsIG(playerid)
{
if(playerid == INVALID_PLAYER_ID) return 1;
new rows,fields,str[160];
cache_get_data(rows,fields,mysql);
if(!rows) return 1;
new fracName[32];
for (new i; i < rows; i++)
{
cache_get_field_content(i, "Name",fracName,mysql);
format(str, sizeof(str), "%s%s \n",str,fracName);
}
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "Factions", str, "OK","");
return 1;
}
Re: Showing dynamic ShowPlayerDialog MySQL -
DavidLuango - 31.07.2016
Works now!