SA-MP Forums Archive
Dialog. - 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: Dialog. (/showthread.php?tid=526863)



Dialog. - TakeiT - 19.07.2014

I had this working fine, however I modified it for multiplayer use. When a project is created, a new table is created in the database for the "ranks" what i'm trying to do is this: When you click "Open Project" it shows any projects that have your name in that table, however, it don't work.



pawn Код:
if(listitem == 1)
            {
                new string[51];
                new string1[MAX_PROJECT_LENGTH];
                for(new i; i<MAX_PROJECTS; i++)
                {
                    new Query[500];
                    format(Query, sizeof(Query), "SELECT * FROM `PROJECT_%d_RANKS` WHERE `ID` = %d", i, PlayerInfo[pid][pID]);
                    mysql_query(Query);
                    mysql_store_result();
                    if(mysql_num_rows())
                    {
                        if(i != MAX_PROJECTS-1)
                        {
                            format(string, sizeof(string), "\n%d:\t%s", i, ProjectInfo[i][prName]);
                            strcat(string1, string);
                        }
                    }
                }
               
                ShowPlayerDialog(pid, Project_Dialog, DIALOG_STYLE_LIST, "Select a project", string1, "Okay", "Cancel");
                PlayerInfo[pid][pProjects] = string1;
            }



Re: Dialog. - sammp - 19.07.2014

Why do it that way when you could just make a table called "projects" and put all of the info in there,

so the layout would be like:

id,
projectid,
projectname,

blablabla


Re: Dialog. - TakeiT - 20.07.2014

Quote:
Originally Posted by sammp
Посмотреть сообщение
Why do it that way when you could just make a table called "projects" and put all of the info in there,

so the layout would be like:

id,
projectid,
projectname,

blablabla
I can't think of a way to do that and save ALL accounts in there, then extract that data. I do have a table called "projects" that holds all other info. However, if say I have 4 people that are rank #1, how am I going to add that to the same table?

That isnt the issue in this case.


Re: Dialog. - sammp - 20.07.2014

Well you just make another row called sub and if theres someone already #1 you add a val to it


Re: Dialog. - TakeiT - 20.07.2014

It's not the saving I care about at the moment, it's checking to see if the player's name is in the project.