Factions
#1

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
Reply
#2

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.
Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)