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



Question - Diti1 - 19.01.2015

hey boys
i was interesting on this example i dont know how i can do it
example i do

/news Server is new to Samp List. and when someone press
/whatsnew to show the messate up here
but example when i want to change news i would press again /news and message after
/whatsnew would be changed to my last edited message someone ? :P


Re: Question - Schneider - 19.01.2015

I created this for you, you'll have to adjust the colors/looks and admin-rights to your own preferences.

At default it will hold a maximum of 6 news-messages, the newest message that's created with /news will be shown at the top and the older message will be moved 1 line down, and the last one will be deleted.

Hope you like it:

pawn Код:
#define MAX_NEWS 6
new ServerNews[MAX_NEWS][145];

COMMAND:whatsnew(playerid, params[])
{
    SendClientMessage(playerid, 0x8CD1E6FF, "Server News:");
    SendClientMessage(playerid, 0x8CD1E6FF, "---------------------------------");
    for(new i; i<MAX_NEWS; i++)
    {
        if(strlen(ServerNews[i]))
        {
            SendClientMessage(playerid, -1, ServerNews[i]);
        }
    }
    SendClientMessage(playerid, 0x8CD1E6FF, "---------------------------------");
    return 1;
}

COMMAND:news(playerid, params[])
{
    new count = (MAX_NEWS-1);
    for(new i; i<MAX_NEWS-1; i++)
    {
        format(ServerNews[count], 145, "%s", ServerNews[count-1]);
        count--;
    }
    format(ServerNews[0], 145, "%s", params);
    SendClientMessage(playerid, -1, "News message added to the news bulletin.");
    return 1;
}