[Tutorial] Random Server Adverts - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Tutorial] Random Server Adverts (
/showthread.php?tid=67166)
[Tutorial] Random Server Adverts -
StrickenKid - 27.02.2009
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:
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!
Re: [Tutorial] Random Server Adverts -
ReV. - 27.02.2009
nice "tutorial" 5/5
sike.....
fail...
No link no nothing
Re: [Tutorial] Random Server Adverts -
Nimphious - 27.02.2009
Quote:
|
Originally Posted by Ethan1233
Tutorial
|
You're an idiot.
Edit: fixed for "backwardsman97".
Re: [Tutorial] Random Server Adverts -
StrickenKid - 27.02.2009
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
Re: [Tutorial] Random Server Adverts -
ReV. - 27.02.2009
its called Preview!!
Never Mind,
Nice tut but dont post when your not done!!
Re: [Tutorial] Random Server Adverts -
Nimphious - 27.02.2009
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.
Re: [Tutorial] Random Server Adverts -
Backwardsman97 - 27.02.2009
Quote:
|
Originally Posted by [FF
Nimphious ]
Quote:
|
Originally Posted by Ethan1233
Tutorial
|
You're an idiot.
|
Sorry, I'm crazy about grammar sometimes.
Re: [Tutorial] Random Server Adverts -
Nimphious - 27.02.2009
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.
Re: [Tutorial] Random Server Adverts -
Backwardsman97 - 27.02.2009
Quote:
|
Originally Posted by [FF
Nimphious ]
Quote:
|
Originally Posted by Ethan1233
Tutorial
|
You're an idiot.
Edit: fixed for "backwardsman97".
|
Re: [Tutorial] Random Server Adverts -
Frank_Tesla - 27.02.2009
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.