SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 27/03/2012, 04:54 PM   #11
Basssiiie
High-roller
 
Basssiiie's Avatar
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 990
Reputation: 191
Default Re: Random Messages [Simple]

Quote:
Originally Posted by Twisted_Insane View Post
By the way, it wouldn't work ANYWAYS, lol! Where are you telling the script to send them random? It has to look like (for example) this:

Code:
public RandomMessages()
{
	new randomMsg = random(sizeof(randomMessages));
	SendClientMessageToAll(COLOR_ORANGERED, randomMessages[randomMsg]);
}
For the information, this is correct:
Code:
SendClientMessageToAll(COLOR_GREEN, RandomMessages[random(sizeof(RandomMessages))];
It works just fine, if you look very carefully you'll see the 'random' function is inside the array. If you still don't see it, here it is:
Code:
SendClientMessageToAll(COLOR_GREEN, RandomMessages[random(sizeof(RandomMessages))];
It works fine. In every parameter where you can put a number, it's also possible to put a function that returns a number, in this case the function is 'random'. You get it?


But still, this isn't a tutorial. Tutorials are supposed to teach people new stuff, and what new stuff have they learned here. How to copy and paste? Oh wait, not. It's not even explained how you can copy or paste a text.
Basssiiie is offline   Reply With Quote
Old 27/03/2012, 04:56 PM   #12
emokidx
Gangsta
 
emokidx's Avatar
 
Join Date: Jul 2011
Posts: 555
Reputation: 63
Default Re: Random Messages [Simple]

Quote:
Originally Posted by Twisted_Insane View Post
Hiddos, tell me how the hell the concept would work? They should become "RANDOM messages", what he does is just sending them to all! He has to get out the info outta the arrray and define them randomly with the function.
he has directly put the random part inside.

SendClientMessageToAll(COLOR_GREEN, RandomMessages[random(sizeof(RandomMessages))];

instead of

new randomMsg = random(sizeof(randomMessages));
SendClientMessageToAll(COLOR_ORANGERED, randomMessages[randomMsg]);

so you can see, that randomMsg is equal to random(sizeof(randomMessages)) so
randomMessages[randomMsg] = RandomMessages[random(sizeof(RandomMessages))
which is basically the same
emokidx is offline   Reply With Quote
Old 27/03/2012, 04:59 PM   #13
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 4,865
Reputation: 2179
Default Re: Random Messages [Simple]

Quote:
Originally Posted by Twisted_Insane View Post
Hiddos, tell me how the hell the concept would work? They should become "RANDOM messages", what he does is just sending them to all! He has to get out the info outta the arrray and define them randomly with the function.
Try it out, it'll output random stuff.
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 27/03/2012, 05:11 PM   #14
FireCat
High-roller
 
FireCat's Avatar
 
Join Date: Jul 2010
Posts: 2,416
Reputation: 596
Default Re: Random Messages [Simple]

Quote:
Originally Posted by Twisted_Insane View Post
Hiddos, tell me how the hell the concept would work? They should become "RANDOM messages", what he does is just sending them to all! He has to get out the info outta the arrray and define them randomly with the function.
Ok lets go in to detail
Code:
SendClientMessageToAll(COLOR_GREEN, RandomMessages[random(sizeof(RandomMessages))];

SendClientMessageToAll <- Function
COLOR_GREEN <- Color
RandomMessages[random(sizeof(RandomMessages)) <- Random

random(sizeof(RandomMessages)
Choosing a random NUMBER from randommessages, because he putted sizeof, so it will get a number.
So say it was 4, its exactly the same as doing:
RandomMessages[4]
FireCat is offline   Reply With Quote
Old 27/03/2012, 06:21 PM   #15
Dripac
Banned
 
Join Date: Apr 2009
Location: Vienna, Austria
Posts: 1,775
Reputation: 256
Default Re: Random Messages [Simple]

Looks completely like my tutorial xD

but mine is just with textdraws

http://forum.sa-mp.com/showthread.php?t=327709
Dripac is offline   Reply With Quote
Old 27/03/2012, 07:22 PM   #16
sniperwars
Huge Clucker
 
Join Date: Jan 2011
Location: Under your bed.
Posts: 444
Reputation: 22
Default Re: Random Messages [Simple]

For fuck sake guys, excuse me for posting a tutorial.
People script different to other people and besides, I didn't copy that
from the SA-MP wiki, I actually scripted that from scratch.
__________________
sniperwars is offline   Reply With Quote
Old 27/03/2012, 08:17 PM   #17
shitbird
High-roller
 
shitbird's Avatar
 
Join Date: Nov 2007
Posts: 1,289
Reputation: 31
Default Re: Random Messages [Simple]

If that's the case, then consider explaining what each individual line does, or assemble some sort of code-roundup, where you explain which part does what.
shitbird is offline   Reply With Quote
Old 29/03/2012, 01:18 PM   #18
Basssiiie
High-roller
 
Basssiiie's Avatar
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 990
Reputation: 191
Default Re: Random Messages [Simple]

Quote:
Originally Posted by sniperwars View Post
For fuck sake guys, excuse me for posting a tutorial.
People script different to other people and besides, I didn't copy that
from the SA-MP wiki, I actually scripted that from scratch.
I do believe you. Have I ever said that I didn't? But still, this isn't a tutorial. The person who's reading it doesn't learn anything from this. You explain nothing about the functions you use. For example: what does SetTimer do and how does it work? Some people might not know this.
Basssiiie is offline   Reply With Quote
Old 02/05/2012, 10:44 AM   #19
$$inSane
Gangsta
 
$$inSane's Avatar
 
Join Date: Feb 2012
Location: Behind you, you cant see me!!!
Posts: 728
Reputation: 56
Default Re: Random Messages [Simple]

its ok.. and simple. nice
__________________
$$inSane is offline   Reply With Quote
Old 18/05/2012, 09:47 PM   #20
RedWingz
Banned
 
Join Date: May 2012
Location: Cluckin' Bell
Posts: 192
Reputation: 25
Default Re: Random Messages [Simple]

Thank's for this thread.
I Wanted to know how to create Random Messages,
And Now I know.
RedWingz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Simple Random Messages 2KY Tutorials 4 19/01/2012 06:58 PM
[Tutorial] How to create Simple Random Messages. [Nikk] Tutorials 13 16/01/2012 04:15 PM
[FilterScript] SW 3D Random Messages [VERY SIMPLE][13.12.2011] SpiderWalk Filterscripts 8 13/12/2011 03:51 PM
[Help] Random Messages Trawltrawl Help Archive 4 16/08/2011 08:50 PM
[FilterScript] P-Messages [Random Messages system] Pooh7 Filterscripts 5 30/11/2010 03:43 PM


All times are GMT. The time now is 09:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.