SA-MP Forums Archive
find if string none? - 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: find if string none? (/showthread.php?tid=626726)



find if string none? - kloning1 - 19.01.2017

Hello, I'm a little confused here

I made a gang mysql system, where one field to save the name of the member
I want to ask, how to add users without bumping into members who are already in the alley?
pawn Код:
stock AddMember(playerid, giveplayerid, gangid)
{
    format(query, sizeof(query), "SELECT `GangMem` FROM `gang` WHERE `ID` = '%d'",gangid);
    mysql_query(mysql, query);
    cache_get_data(rows, fields);
    if(rows)
    {
        cache_get_field_content(0, "GangMem", query);
        sscanf(query, "p<,>sssss", gnamtemp[0],gnamtemp[1],gnamtemp[2],gnamtemp[3],gnamtemp[4]);



Re: find if string none? - Vince - 19.01.2017

This is not the proper way to go about it. A field should only ever contain one nominal value. Delimited lists are simply not done. There is a tutorial in my sig about association tables which you may find useful.


Re: find if string none? - kloning1 - 19.01.2017

um, or maybe I have to separate between the members of the group? The above is the way I wrong?

What impact, if I still choose to use the way I like above?


Re: find if string none? - X337 - 19.01.2017

That's not wrong, but that's a bad way to save gang members in 1 column.
You should've make one more table for gang members and add foreign key to your gang table. That way will make you easier to add / remove a gang member.