07.01.2012, 07:42
(
Last edited by [Nikk]; 17/01/2012 at 06:37 AM.
)
Delete this.
public MensajesRamdom()//Public what sends the messages
public MensajesRamdom()//Callback that sends the messages
Your explanations could be even more resolving though. For example:
pawn Code:
pawn Code:
Else, it's a good tutorial. |
C:\Users\JUAN\Desktop\samp03\gamemodes\ww2.pwn(205 ) : error 021: symbol already defined: "RandomMessages"
C:\Users\JUAN\Desktop\samp03\gamemodes\ww2.pwn(206 ) : error 028: invalid subscript (not an array or too many subscripts): "RandomMessages" C:\Users\JUAN\Desktop\samp03\gamemodes\ww2.pwn(206 ) : error 072: "sizeof" operator is invalid on "function" symbols C:\Users\JUAN\Desktop\samp03\gamemodes\ww2.pwn(206 ) : error 029: invalid expression, assumed zero C:\Users\JUAN\Desktop\samp03\gamemodes\ww2.pwn(206 ) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors. |
#include <a_samp>
new RandomMessagesList[][] =//We create a variable || Not the same Name as the Callback we created
{//open
"TIP: Visit our forums! www.lala.lala",//Example Message
"Forum sa:mp it's the best web ever!",//Example Messge
"I love mi mom :D"//This is the last message, in the last message dont put a " , " in the end.
};//Close
public OnFilterScriptInit()
{
SetTimer("RandomMessages", 120000, true);// 2 minutes for message
return 1;
}
forward RandomMessages();//This will be the forward
public RandomMessages()//Public what sends the messages
{
SendClientMessageToAll(0xFF0000FF, RandomMessagesList[random(sizeof(RandomMessagesList))]);//Function what send the messages, with timer, and messages info. || Random from the variable with the Message List.
}
//At the top of your script, near your other definitions -
#define RANDOM_MESSAGE1 "This is random message numero uno!"
#define RANDOM_MESSAGE2 "This is random message numero dos!"
#define RANDOM_MESSAGE3 "This is random message numero tres!"
#define RANDOM_MESSAGETIMEINMINUTES 3 //Every three minutes a random message will be shown.
//OnGameModeInit / OnFilterScriptInit -
SetTimer("ShowARandomMessage", RANDOM_MESSAGETIMEINMINUTES*60000, true); //3 * 60000 = 180,000 milliseconds which translates to 3 minutes.
//Somewhere else in your script (OUTSIDE of a callback) -
forward ShowARandomMessage();
public ShowARandomMessage()
{
new
RandomSelection = random(3); //Randoms start from 0 and work their way up -- THEY DO NOT START AT 1.
switch(RandomSelection) {
case 0: {
return SendClientMessageToAll(0xE8B210FF, RANDOM_MESSAGE1);
}
case 1: {
return SendClientMessageToAll(0xE8B210FF, RANDOM_MESSAGE2);
}
case 2: {
return SendClientMessageToAll(0xE8B210FF, RANDOM_MESSAGE3);
}
}
return 1;
}