[Needed help] With random text -
mickos - 21.06.2012
Hey I just make some random text but I got 8 errors, I have try alot of thinks but it didnt helped.
So, I hope you can help me.
Code:
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
new RandomMSG[][] =
{
"* SERVER:New here?, go visit us forum for all info about the server.",
"* SERVER:Dont registered in us server?, /register and you will be automatically logged in.",
"* SERVER:Dont worry about your stats, if you are registered it will be automatically saved."
};
SetTimer("SendMSG", 60000, true);
// 60000ms = 60 seconds = 1 minute
forward SendMSG();
public SendMSG("* New here?, go visit us forum for all info about the server.",)
public SendMSG("* Dont registered in us server?, /register and you will be automatically logged in.",) // What it looks at the moment
public SendMSG("* Dont worry about your stats, if you are registered it will be automatically saved.")
{
new randMSG = random(sizeof(RandomMSG)); //calculates the size of RandomMSG (which is 3)
SendClientMessageToAll(0xFFFFFF, RandomMSG[randMSG]); // Replace the "color" with your defined color.
}
public SendMSG()
{
new randMSG = random(sizeof(RandomMSG));
SendClientMessageToAll(0xFFFFFF, RandomMSG[randMSG]); // Replace the "COLOR" with your defined color.
}
#endif
Errors:
PHP код:
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(14) : error 021: symbol already defined: "SetTimer"
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(19) : error 010: invalid function or declaration
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(21) : error 001: expected token: ")", but found "public"
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(21) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(23) : error 001: expected token: ")", but found "public"
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(23) : error 021: symbol already defined: "SendMSG"
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(23) : error 010: invalid function or declaration
C:\Users\Edward\Desktop\samp server mick en roy\pawno\randomtext.pwn(23) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.
Thankss
Re: [Needed help] With random text -
Macluawn - 21.06.2012
1) SetTimer must be used inside a function or a callback.
2) What are you trying to do with "SendMSG" ?
3) You cant have more than one callback with the same name.
Re: [Needed help] With random text -
mickos - 21.06.2012
Ok, now I got it so:
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
new RandomMSG[][] =
{
"* SERVER:New here?, go visit us forum for all info about the server.",
"* SERVER:Dont registered in us server?, /register and you will be automatically logged in.",
"* SERVER:Dont worry about your stats, if you are registered it will be automatically saved."
};
SetTimer("SendMSG", 60000, true);
// 60000ms = 60 seconds = 1 minute
forward SendMSG();
public SendMSG 1:("* New here?, go visit us forum for all info about the server.",)
{
SetTimer("SendMSG", 60000, true);
}
public SendMSG 2:("* Dont registered in us server?, /register and you will be automatically logged in.",) // What it looks at the moment
{
SetTimer("SendMSG", 60000, true);
public SendMSG 3:("* Dont worry about your stats, if you are registered it will be automatically saved.")
{
new randMSG = random(sizeof(RandomMSG)); //calculates the size of RandomMSG (which is 3)
SendClientMessageToAll(0xFFFFFF, RandomMSG[randMSG]); // Replace the "color" with your defined color.
}
public SendMSG()
{
new randMSG = random(sizeof(RandomMSG));
SendClientMessageToAll(0xFFFFFF, RandomMSG[randMSG]); // Replace the "COLOR" with your defined color.
}
#endif
But when I now try to compile it, my pawno didnt work,
Re: [Needed help] With random text -
Saw® - 21.06.2012
You didn't put SetTimer() inside a Callback or Function
Re: [Needed help] With random text -
mickos - 21.06.2012
Ahh, I need put it in the sendclientmessage?
Re: [Needed help] With random text -
Mr.1337 - 21.06.2012
Try this
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
new RandomMSG1[][] =
{
"* SERVER:New here?, go visit us forum for all info about the server.",
};
new RandomMSG2[][] =
{
"* SERVER:Dont registered in us server?, /register and you will be automatically logged in.",
};
new RandomMSG3[][] =
{
"* SERVER:Dont worry about your stats, if you are registered it will be automatically saved."
};
SetTimer("SendMSG1", 60000, true);
SetTimer("SendMSG2", 60000, true);
SetTimer("SendMSG3", 60000, true);
// 60000ms = 60 seconds = 1 minute
forward RandomMSG1();
public RandomMSG1()
}
new RandomMSG1 = random(sizeof(randomMessages1));
SendClientMessageToAll(0xFFFFFF, randomMessages1[randomMsg]);
}
forward RandomMSG2();
public RandomMSG2()
}
new RandomMSG2 = random(sizeof(randomMessages2));
SendClientMessageToAll(0xFFFFFF, randomMessages1[randomMsg]);
}
forward RandomMSG3();
public RandomMSG13()
}
new RandomMSG13 = random(sizeof(randomMessages13));
SendClientMessageToAll(0xFFFFFF, randomMessages1[randomMsg]);
}
#endif
Re: [Needed help] With random text -
mickos - 21.06.2012
Ah man thank u!!
I gonna try it

!
Re: [Needed help] With random text - [jS]Thomas - 21.06.2012
That's a lot of unnecessary coding. This should work:
pawn Код:
#include <a_samp>
new RandomMSG[][] =
{
"* SERVER:New here?, go visit us forum for all info about the server.",
"* SERVER:Dont registered in us server?, /register and you will be automatically logged in.",
"* SERVER:Dont worry about your stats, if you are registered it will be automatically saved."
};
forward SendMSG();
public OnGameModeInit()
{
SetTimer("SendMSG", 60000, true);
return 1;
}
public SendMSG()
{
new randMSG = random(sizeof(RandomMSG));
SendClientMessageToAll(0xFFFFFF, RandomMSG[randMSG]);
return 1;
}