Can anyone help me with the script? - 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)
+--- Thread: Can anyone help me with the script? (
/showthread.php?tid=520480)
Can anyone help me with the script? -
Ritzy2K - 19.06.2014
Hello, i need pawn script on how to put random messages o the server.. m totally noob ad new i the scripting.. dot think that m spamming.. i earlier checked the tutorial by twisted_insane on how to add random message i was totally lost.. what to do and how to do? ca anyone tell me whole script for random message n where to put it in starting or at middle or at the end..
thanks again..
n yes as soon as i get 50 post ill give u guys +rep
Re: Can anyone help me with the script? -
Laurey - 19.06.2014
Well, first your random message defines,
pawn Код:
#define RANDOM_MESSAGE1 "- Message here."
#define RANDOM_MESSAGE2 "- Message here"
#define RANDOM_MESSAGE3 "- Message here. "
#define RANDOM_MSGTIME 20
The set the timer to show up your random messages in the gamemode init
pawn Код:
SetTimer("RandomMessage", RANDOM_MSGTIME*60000, true);
Then your public of the RandomMessage
pawn Код:
forward RandomMessage();
public RandomMessage()
{
new RandSelect= random(3);
switch(RandSelect) {
case 0: {
return SendClientMessageToAll(COLOR_WHITE, RANDOM_MESSAGE1);
}
case 1: {
return SendClientMessageToAll(COLOR_WHITE, RANDOM_MESSAGE2);
}
case 2: {
return SendClientMessageToAll(COLOR_WHITE, RANDOM_MESSAGE3);
}
}
return 1;
}
Note: You can define more messages as per your wish to show more of them. Also you can rep now which stays pending till you reach 50 posts.
Re: Can anyone help me with the script? -
Threshold - 19.06.2014
pawn Код:
#define MSG_TIME 120
//This will define the number of seconds between each message. This one is 120 second (2 minute) intervals.
new RandMessages[][128] =
{
"This is my first random message.",
"This is my second random message that will be used to tell them something funny.",
"I'm kind of running out of stuff to write about, but this is my third message to send.",
"Oh why not, let's add a fourth message."
};
//NOTE: You must put a ',' after every message, except for the last one.
public OnGameModeInit() //Called when the gamemode script is loaded
{
SetTimer("SendRandomMessage", MSG_TIME * 1000, true); //Sets a timer for the time defined in 'MSG_TIME' and repeats.
//Rest of your code..
return 1;
}
forward SendRandomMessage(); //This should be the same name as the timer in OnGameModeInit.
public SendRandomMessage()
{
SendClientMessageToAll(0xFF0000FF, RandMessages[random(sizeof(RandMessages))]);
//Send the random message to everyone. '0xFF0000FF' is RED.
return 1;
}
Re: Can anyone help me with the script? -
Ritzy2K - 19.06.2014
Thanks for the help laurey and thres.. i made it