SA-MP Forums Archive
A little doubt - 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: A little doubt (/showthread.php?tid=486473)



A little doubt - Face9000 - 08.01.2014

I like organized things so i decided to do a thing:

How i can make a stock that increase a selected row with different "cases" which i can select?

Like this:

pawn Код:
stock IncreaseStats(rowtoincrease)
{
        case 0:
        {
            new stats[128]; //Increase total accounts value
           format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1 WHERE                  condition  = true");
       mysql_query(stats);
        }
        case 1:
        {
new stats[128]; //Increase total ac value
format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAcBans= TotalAcBans + 1 WHERE condition = true");
mysql_query(stats);
        }
    }
    return 1;
}
And adding like this in a string: "IncreaseStats(0)" that will increase total accounts value, and 1 to increase total ac bans.

Got it what im saying?

P.S Sorry for bad identation, i dont know why pawn tag fucks it lol


Re: A little doubt - Face9000 - 09.01.2014

Bump.


Re: A little doubt - sammp - 09.01.2014

What are you trying to do? I don't really get what you're trying to do.


Re: A little doubt - tyler12 - 09.01.2014

pawn Код:
stock IncreaseStats(name[50],value = 1)
{
    new query[250];
    format(query,sizeof(query),"UPDATE `ServerStats` SET %s = %s + 1",name,name,value);
    return mysql_query(query);
}