#1

Hey guys im having a minor issue.

task SendLexieMSG[240000]()
{
new RandMSG = random(sizeof(LVCNR_LEXIE_Mainchat_Messages));
SendClientMessageToAll(WHITE, LVCNR_LEXIE_Mainchat_Messages[RandMSG]);
return 1;
}

Why is that crashing pawno?
Does anyone have any idea?
Reply
#2

I guess that's supposed to be a function, so mainly the 'task' word and this '[240000]' should not be there. You should provide more information anyways, like constant real values.
Reply
#3

lol what?
Its a task sending a random message that i predefined.

Anyways if you would like to see it sure.
Код:
new Lexie;

new LVCNR_LEXIE_Mainchat_Messages[] =
{
    "Welcome to Las Venturas Cops And Robbers.",
    "New here ? use /faqs to get help.",
    "You can purchase Master Degrees(Skills) from New Vegas University at New Vegas Square.",
    "Need help? Use /help and /faqs, use /ask for assistance.",
    "Donate today for epic features, items and more! Contact us on our Forum",
    "Please read /rules, /pc and /faqs regularly, as they may change randomly.",
    "Spotted a player hacking/cheating/breaking rules? Use /report [name/id] [reason]",
    "Welcome to our Server, we hope you enjoy playing with us!"
};
Reply
#4

Have you tried a shorter variable name? Long variable names in excess of 26-ish characters do not bode well. The manual only says this:
Quote:

A parser may truncate an identifier after a maximum length. The
number of significant characters is implementation defined, but it is
at least 16 characters.

So it's probably best to keep names under 16 characters, even.
Reply
#5

its this that is causing the error on compiling tho..
new RandMSG = random(sizeof(LVCNR_LEXIE_Mainchat_Messages));
SendClientMessageToAll(WHITE, LVCNR_LEXIE_Mainchat_Messages[RandMSG]);
Reply
#6

any other way to pick a random message to echo?
Reply
#7

okay so i debugged the code.
also made an edit since vince suggested that.

Код:
task SendLexieMSG[240000]()
{
    new RandMSG = random(sizeof(Lexie_Messages));
	SendClientMessageToAll(WHITE, Lexie_Messages);
	return 1;
}
new RandMSG = random(sizeof(Lexie_Messages));

Is causing pawncc to crash
Reply
#8

pawn Код:
new LVCNR_LEXIE_Mainchat_Messages[][] =
and problem can be in y_timers.inc
Reply
#9

Fixed nevermind, it was the task itself.
forward RandomMessages();
public RandomMessages()
{
new randomMsg = random(sizeof(randomMessages));
SendClientMessageToAll(COLOR_WHITE, randomMessages[randomMsg]);
}
seems to work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)