SA-MP Forums Archive
Factions - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Factions (/showthread.php?tid=215118)



Factions - Anthonyx3' - 22.01.2011

Hey guys im making my faction system today, dynamic mysql. Im a bit stuck on my createfaction cmd..:

pawn Код:
CMD:createfaction(playerid, params[]) {
        new string[180];
        if(UserStats[playerid][Admin] > 4) {
        format(string, sizeof(string), "INSERT INTO `Factions` (Name) VALUES('%s')", inputtext);
This is all i have so far, but im not sure how do i make it add a new faction to my database, like first time i do it, it creates fsqlid 1, then next would be 2, then 3, then etc. Thanks in advance


Re: Factions - Mike Garber - 22.01.2011

The string size is 180? I recommend making it smaller, your faction name aint gonna be 140 characters long, is it?

Make It 60 or 64, that keeps 20/24 characters for the faction name.


Re: Factions - Kaylux - 22.01.2011

You need to create a global var called "Faction Count" or something. When you load the facions FactionCount++. And have the database AI. Then I guess:
pawn Код:
CMD:createfaction(playerid, params[])
{
        new string[180];
        //Use something like sscanf to extract the name
        if(UserStats[playerid][Admin] > 4)
        {
                format(string, sizeof(string), "INSERT INTO `Factions` (Name) VALUES('%s')", string);
         }
Also note ">" means is greater. I'm guessing you want to do ">=" is greater or equil to.


Re: Factions - Anthonyx3' - 22.01.2011

Yeah i have bad scripting habits, i start off with 180 then ill lower it when im done, horrible i know xD.