05.11.2009, 21:24
Quote:
Originally Posted by PANNA
just givve me the good code without that error please.
|
He gave you perfectly good code, and advice. Listen to him next time :P. (functions can not be placed outside of defines/callbacks/custom subroutines)
pawn Код:
#include <a_samp>
#define MESSAGE_TIME 60 //how many seconds it takes to show the next message
#define DEFAULT_SHOW_TIME 10 //Default time for the messages to be shown
#define DEFAULT_STYLE 3 //defualt syle for the messages
new MessageID, bool:Static;
enum MessageData
{
Message[128],
DisplayTime,
Style
}
new ServerMessages[][MessageData] =
{
//Message, DisplayTime, Style
{"ZOMG MESSAGE 1", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
{"ZOMG MESSAGE 2", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
{"ZOMG MESSAGE 3", DEFAULT_SHOW_TIME,DEFAULT_STYLE},
{"ETC", DEFAULT_SHOW_TIME,DEFAULT_STYLE}
};
public OnFilterScriptInit()
{
Static = true;
SetTimer("SendServerMessage", MESSAGE_TIME*1000, true);
return 1;
}
forward SendServerMessage();
public SendServerMessage()
{
if(Static == false)
{
new ID = random(sizeof(ServerMessages));
GameTextForAll(ServerMessages[ID][Message],ServerMessages[ID][DisplayTime]*1000,ServerMessages[ID][Style]);
return 1;
}
if(MessageID < sizeof(ServerMessages) && Static == true)
{
GameTextForAll(ServerMessages[MessageID][Message],ServerMessages[MessageID][DisplayTime]*1000,ServerMessages[MessageID][Style]);
MessageID++;
return 1;
}
MessageID = 0;
GameTextForAll(ServerMessages[MessageID][Message],ServerMessages[MessageID][DisplayTime]*1000,ServerMessages[MessageID][Style]);
MessageID++;
return 1;
}
sorry, dont have time to test it ... post any problems and i'll fix them (if there are any).
Works fine. Use the gametext color codes to change the color of the message etc..