Lemme Clarify myself
Ok, i have been trying to make a warrant system for cops which is mysql. I got it to insert just fine. But when i go to the dialog to check the warrants, It only prints 1 name or no names.
Baically i want a dialog to show all the names in the database of players who have warrants.
How would i get it to print all the names in the warrants table under field PlayersName.
My enum
pawn Код:
enum wWarrants
{
wPId,
wPname[24],
wWantedFor[64],
wGivenBy[24],
wStatus[64]
};
new Warrants[MAX_PLAYERS][wWarrants];
The code that suppose to shwo all the names
pawn Код:
format(Query, sizeof (Query), "SELECT PlayersName FROM warrants");
mysql_query(Query);
mysql_store_result( );
printf("%s",Query);
format(str, sizeof (str), "%s\n",Warrants[WarrantCount][wPname]);
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, 38, DIALOG_STYLE_LIST, "Open Warrants", str, "Get Info", "Cancel");
I know i got somthing wrong but i can't figure it out.
WarrantCount comes from this
pawn Код:
stock LoadMysqlWarrants()
{
format(Query, sizeof(Query), "SELECT * FROM warrants");
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Query))
{
sscanf(Query, "e<p<|>ds[24]s[64]s[24]s[64]>", Warrants [ WarrantCount ]);
printf("%s",Query);
printf(" Warrants Id: %s",Warrants[WarrantCount][wPId]);
printf(" Warrants Name: %s",Warrants[WarrantCount][wPname]);
printf("Wanted For: %s",Warrants[WarrantCount][wWantedFor]);
printf("GivenBy: %s",Warrants[WarrantCount][wGivenBy]);
printf("Status: %s",Warrants[WarrantCount][wStatus]);
WarrantCount++;
}
}
mysql_free_result();
printf("%d Warrants('s) Loaded From Mysql DataBase", WarrantCount);
return 1;
}