[Tutorial] Random message Tutorial by Toxik
#1

So lets start
Creating Arry for random message and adding messages
pawn Код:
//on top of script
#define     COLOR_GREEN     (0x32CD32FF)  // Green color used for Random messages
  new randomMessages[][] =  //here, we're creating the array with the name "randomMessages"
    {
        "MESSAGE 1 ", //this is the text of your first message ------Change the MESSAGE 1 to your own message
        "MESSAGE 2", //this is the text of your second message -------- Change MESSAGE 2 to your own message
        "MESSAGE 3" //this is the text of your third message ---------- Change MESSAGE 3 to your own message
};
Creating Timer
pawn Код:
OnGameModeInit()
{
SetTimer("RandomMessages", 1000*6, true); //here, you're defining a timer with the name "RandomMessages"
return 1;
forwarding the Random message
pawn Код:
forward RandomMessages();
public RandomMessages()
{
    new randomMsg = random(sizeof(randomMessages)); //create a variable "randomMsg" and give it the value of our array we've created ("randomMessages")
//the word "random" is included into PAWN, which will tell the script, to work randomly with the array
    SendClientMessageToAll(COLOR_GREEN, randomMessages[randomMsg]); //this will send the content of our array to EVERYBODY on the server
// the content are strings, and we're using our array "randomMessages" with our created variable "randomMsg" again
}
Reply
#2

There are already lot of tutorials for that.
Reply
#3

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
There are already lot of tutorials for that.
Didn't Check out
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=324497
https://sampforum.blast.hk/showthread.php?tid=375921
https://sampforum.blast.hk/showthread.php?tid=401096
https://sampforum.blast.hk/showthread.php?tid=341291
https://sampwiki.blast.hk/wiki/Random_Messages
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)