Prima data creati o variabila globala, ca aici:
Code: Select all
new randomtimer;
Code: Select all
forward RandomMsgs();
Code: Select all
randomtimer = SetTimer("RandomMsgs", timpul in milsecunde*, 1);
Code: Select all
public RandomMsgs()
{
new rand = random(catemesajeaveti)+1; msgs = rand; RandomMsgs2();
return 1;
}
Code: Select all
new msgs = 0;
Code: Select all
forward RandomMsgs2();
Code: Select all
public RandomMsgs2()
{
new string[256];
new stringmsg[256];
if(msgs == 1)
{
stringmsg = "Salut !";
}
if(msgs == 2)
{
stringmsg = "La revedere !"; // si asa mai departe
}
format(string, sizeof(string), "%s", stringmsg);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}
________________________________________________________
* = timpul in milisecunde (60000 = 1min).