[Tutorial] Random Server Adverts
#1

Tutorial
Heres my first tut! a tut on how to make random server adverts!

First: add to the top of your GM
pawn Код:
#define COLOR_CYAN 0x99FFFFAA // cyan
pawn Код:
new AdvertMessage[5][100] = // [5] = amount of messages, [100] = amount of characters to give
{
    {"Ad: Donate To The Server!"},
    {"Ad: Visit Our Forums!"},
    {"Ad: Visit Out Site!"},
    {"Ad: Got A Question? Visit The FAQ"},
    {"Ad: Be Cool!"}
};

Those messages are examples of what it could say... just remember, the "[100]" means the ammount of characters so the bigger the message, the more your going to need to add to that.

Next: where you put your forwards put:
pawn Код:
forward AdvertMsg();
Next: under your GameModeInit
pawn Код:
SetTimer("AdvertMsg",60000,1);
The "60000" = 1 minute, this means a random message will be sent to all ever 1 minute. You Can Change it to whatever You Want To!

Next: at the bottom of your script
pawn Код:
public AdvertMsg()
{
  for (new i = 0; i < MAX_PLAYERS; i++)
  {
    new rand;
    rand = random(sizeof(AdvertMessage));
    SendClientMessageToAll(COLOR_CYAN,AdvertMessage[rand][0]);
    break;
   
  }
    return 1;
}
you can put whatever color you want to but i put cyan.

And Thats it! Now You can send advert messages to your players!
Reply
#2

nice "tutorial" 5/5



sike.....

fail...

No link no nothing
Reply
#3

Quote:
Originally Posted by Ethan1233
Tutorial
You're an idiot.

Edit: fixed for "backwardsman97".
Reply
#4

i accidentally clicked "post" instead of preview because i wanted to see how big the tutorial text would be, you people dont have to be such assholes
Reply
#5

its called Preview!!


Never Mind,

Nice tut but dont post when your not done!!
Reply
#6

Quote:
Originally Posted by Ethan1233
i accidentally clicked "post" instead of preview because i wanted to see how big the tutorial text would be, you people dont have to be such assholes
Oic, I apologise.
Reply
#7

Quote:
Originally Posted by [FF
Nimphious ]
Quote:
Originally Posted by Ethan1233
Tutorial
You're an idiot.
Sorry, I'm crazy about grammar sometimes.
Reply
#8

Quote:
Originally Posted by backwardsman97
Quote:
Originally Posted by [FF
Nimphious ]
Quote:
Originally Posted by Ethan1233
Tutorial
You're an idiot.
Sorry, I'm crazy about grammar sometimes.
Fixed.
Reply
#9

Quote:
Originally Posted by [FF
Nimphious ]
Quote:
Originally Posted by Ethan1233
Tutorial
You're an idiot.

Edit: fixed for "backwardsman97".
Reply
#10

Quote:
Originally Posted by Ethan1233
pawn Код:
new AdvertMessage[5][100] = // [5] = amount of messages, [100] = amount of characters to give
{
    {"Ad: Donate To The Server!"},
    {"Ad: Visit Our Forums!"},
    {"Ad: Visit Out Site!"},
    {"Ad: Got A Question? Visit The FAQ"},
    {"Ad: Be Cool!"}
};
Those messages are examples of what it could say... just remember, the "[100]" means the ammount of characters so the bigger the message, the more your going to need to add to that.
There's no need to define anything here, actually. AdvertMessage[][0] would work just as well. And you don't need {} brackets for each item either.


Quote:
Originally Posted by Ethan1233
pawn Код:
public AdvertMsg()
{
  for (new i = 0; i < MAX_PLAYERS; i++)
  {
    new rand;
    rand = random(sizeof(AdvertMessage));
    SendClientMessageToAll(COLOR_CYAN,AdvertMessage[rand][0]);
    break;
   
  }
    return 1;
}
You're using a useless loop which will send a random message globally 200 times. Surely this is not what you intended. Test this code with more than one person on your server. I'm afraid you are starting with a few misconceptions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)