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



Random MOTD - Youssef221 - 19.07.2015

How Do I Make This Sends Random Saved MOTDs?

pawn Код:
for(new i = 0; i < MAX_GANGS; i++)
    {
        if(dini_Exists(gFileId(i)))
        {
        if(strval(dini_Get(gFileId(i),"GangMOTD")) != -1)
        {
        new motd[128];
        format(motd,sizeof(motd),"MOTD: %s",dini_Get(gFileId(i),"GangMOTD"));
        SendClientMessageToAll(0xFFB300FF, motd);
        break;
        }
        }
    }
It only sends me the MOTD of the first gang.

NOTE I will convert Dini to MySQL later just tell me about the motd thing.


Re: Random MOTD - Glenn332 - 19.07.2015

Remove break;


Re: Random MOTD - Youssef221 - 19.07.2015

That Will Cause Every Saved MOTD Being written like:

It will send me this:

MOTD: Blabla
MOTD BLAHBLAh

That when I have 2 Saved MOTDs


Re: Random MOTD - Glenn332 - 19.07.2015

Break stop the loop if you want just a few to be selected you can use something like this
if (i == 10) break;
But yeah dont put break there wherr you currently have it cause its gonna break the loop at first finding!!