SA-MP Forums Archive
How To Make Ramdom Message - 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: How To Make Ramdom Message (/showthread.php?tid=392643)



How To Make Ramdom Message - Team_PRO - 15.11.2012

Hey Guys I jUst Want To Know How To Make Some Ramdom Message


Re: How To Make Ramdom Message - xMCx - 15.11.2012

pawn Код:
new RandomMSG[][] =
{
    "1: ..",//This is the first message it will send,You ca change it to any thing you want.
    "2: ..",//Second Message
    "3: ..",//Third Message
    "4: ..",//Fourth Message
    "5: .."//fifth Message
};
forward SendMSG();
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(-1, RandomMSG[randMSG]);
}
//under GameModeInit()
SetTimer("SendMSG", 300000, true);



Re: How To Make Ramdom Message - Team_PRO - 15.11.2012

Quote:
Originally Posted by xMCx
Посмотреть сообщение
pawn Код:
new RandomMSG[][] =
{
    "1: ..",//This is the first message it will send,You ca change it to any thing you want.
    "2: ..",//Second Message
    "3: ..",//Third Message
    "4: ..",//Fourth Message
    "5: .."//fifth Message
};
forward SendMSG();
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(-1, RandomMSG[randMSG]);
}
//under GameModeInit()
SetTimer("SendMSG", 300000, true);
Ok I Will Try This


Re: How To Make Ramdom Message - xMCx - 15.11.2012

Quote:
Originally Posted by Team_PRO
Посмотреть сообщение
Ok I Will Try This
tell me if it worked


Re: How To Make Ramdom Message - DaRk_RaiN - 15.11.2012

If you want random messages via textdraw
PHP код:
http://forum.sa-mp.com/showthread.php?t=327709 
If you want it with SendClientMessageToAll use timers. Example:
PHP код:
forward Random1();
forward Random2();
forward Random3();
OnPlayerConnect
SetTimer
("Random1",20000,1);
SetTimer("Random2",30000,1);
SetTimer("Random3",40000,1);
public 
Random1()
{
SendClientMessageToAll(COLOR_LIME,"Seen a hacker report...");
}
public 
Random2()
{
SendClientMessageToAll(COLOR_LIME,".............");
}
public 
Random3()
{
SendClientMessageToAll(COLOR_LIME,"GTFO this server...");




Re: How To Make Ramdom Message - Team_PRO - 15.11.2012

Quote:
Originally Posted by xMCx
Посмотреть сообщение
tell me if it worked
It Work
i will use it too
Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
If you want random messages via textdraw
PHP код:
http://forum.sa-mp.com/showthread.php?t=327709 
If you want it with SendClientMessageToAll use timers. Example:
PHP код:
forward Random1();
forward Random2();
forward Random3();
OnPlayerConnect
SetTimer
("Random1",20000,1);
SetTimer("Random2",30000,1);
SetTimer("Random3",40000,1);
public 
Random1()
{
SendClientMessageToAll(COLOR_LIME,"Seen a hacker report...");
}
public 
Random2()
{
SendClientMessageToAll(COLOR_LIME,".............");
}
public 
Random3()
{
SendClientMessageToAll(COLOR_LIME,"GTFO this server...");

Thanks i will use this


Re: How To Make Ramdom Message - Michael_Cruise - 15.11.2012

Код:
forward RandomMessage();
public OnGameModeInit()
{
SetTimer("RandomMessage",120000,1);
return 1;
}
public RandomMessage()
{
	new mrand =random(10);
	new string[128];
	if(mrand == 1)
	{
            //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 2)
	{
            //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 3)
	{
            //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 4)
	{
           //SendClientMessageToAll(COLOR,MESSAGE)

	}
	if(mrand == 5)
	{
	   //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 6)
	{
	    //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 7)
	{
	    //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 8)
	{
	    //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 9)
	{
	    //SendClientMessageToAll(COLOR,MESSAGE)
	}
	if(mrand == 10)
	{
	    //SendClientMessageToAll(COLOR,MESSAGE)
	}
}



Re: How To Make Ramdom Message - Edvin - 15.11.2012

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
If you want random messages via textdraw
PHP код:
http://forum.sa-mp.com/showthread.php?t=327709 
If you want it with SendClientMessageToAll use timers. Example:
PHP код:
forward Random1();
forward Random2();
forward Random3();
OnPlayerConnect
SetTimer
("Random1",20000,1);
SetTimer("Random2",30000,1);
SetTimer("Random3",40000,1);
public 
Random1()
{
SendClientMessageToAll(COLOR_LIME,"Seen a hacker report...");
}
public 
Random2()
{
SendClientMessageToAll(COLOR_LIME,".............");
}
public 
Random3()
{
SendClientMessageToAll(COLOR_LIME,"GTFO this server...");

LOL ...
Quote:

SetTimer("Random1",20000,1);
SetTimer("Random2",30000,1);
SetTimer("Random3",40000,1);
public Random1()
{
SendClientMessageToAll(COLOR_LIME,"Seen a hacker report...");
}
public Random2()
{
SendClientMessageToAll(COLOR_LIME,".............") ;
}
public Random3()
{
SendClientMessageToAll(COLOR_LIME,"GTFO this server...");
}

if i will need 20 messages, i will make for that 20 timers? =) this is not a good option.

use xMCx script:
Quote:
Originally Posted by xMCx
Посмотреть сообщение
pawn Код:
new RandomMSG[][] =
{
    "1: ..",//This is the first message it will send,You ca change it to any thing you want.
    "2: ..",//Second Message
    "3: ..",//Third Message
    "4: ..",//Fourth Message
    "5: .."//fifth Message
};
forward SendMSG();
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(-1, RandomMSG[randMSG]);
}
//under GameModeInit()
SetTimer("SendMSG", 300000, true);



Re: How To Make Ramdom Message - Faisal_khan - 15.11.2012

More no. of timers = more lag.