[SOLVED]Need a little help with News Flash
#1

Hi, I have this script that shows a news message every 4 minutes.
But now, it only shows 1 message.
How could I make it so, that it randomly picks a message from a list, and shows 1 of them every 4 minutes?
Here's my script:

On top of script:
pawn Код:
forward NewsFlash();
Under OnGameModeInit:
pawn Код:
SetTimer("NewsFlash",1000*60*4, true);
And somewhere in my script:
pawn Код:
public NewsFlash()
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
    if(IsPlayerConnected(i))
    {
            SendClientMessage(i, 0x800080FF, "*** Type /help for all commands ***");
    }
  }
}
Please help
Reply
#2

new News[5][128] = {
{"bla"},
{"bla"},
{"bla"},
{"bla"},
{"bla"}
};

public NewsFlash()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
new newsf = random(sizeof(News));
if(IsPlayerConnected(i))
{
SendClientMessage(i, 0x800080FF, News[newsf]);
}
}
}

cheerz
Reply
#3

Thanx
It works fine
Solved, you can lock topic now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)