RandomMessages

From SA-MP

Jump to: navigation, search

Preparements

This is the tutorial about making random messages show up.

Firstly, we'll set the messages ready:

new RandomMSG[][] =
{
    "Random Message 1",
    "Random Message 2",
    "Random Message 3"
};


Setting up the function

The function we'll use is called "SendMSG", so lets forward it (Forwarding)

forward SendMSG();

Now, lets do the function itself:

public SendMSG()

Making the message show

Head to the callback (Forwarded already, set up in somewhere in the script below main())

public SendMSG() // What it looks at the moment

So, lets open the callback (do the following as shown):

public SendMSG()
{
    // effect
}

Now, we'll do the effect at "//effect" (NOTE: "//effect" isn't some special character. "//" gives You a comment line) Simply,

SendClientMessageToAll(COLOR, RandomMSG[random(sizeof(RandomMSG))]); // Replace the "color" with your defined color.
Personal tools