Random Message Help
#1

Script where the 4 errors are:
pawn Код:
new randMSG = random(sizeof(RandomMSG));
PAWNO Compiler:
pawn Код:
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(31) : error 017: undefined symbol "random"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(31) : error 001: expected token: ";", but found "sizeof"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(31) : warning 215: expression has no effect
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(31) : error 001: expected token: ";", but found ")"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(31) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Please help.
Reply
#2

What's the line before that, because that line does not contain an error.
Reply
#3

pawn Код:
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(COLOR_GREEN, RandomMSG[randMSG]);
}
Reply
#4

Try this code. Just insert your random messages where I commented.
pawn Код:
// Random Messages
new RandomMSG[][] =
{
    // Insert your random messages here.
};

forward SendMSG();
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(COLOR_GREEN, RandomMSG[randMSG]);
}
EDIT: When you insert your random messages make sure to have quotations mark at the start and end of each of them.
Reply
#5

Should I just remove all of my current parts of the script regarding to my Random Messages?
Reply
#6

Can you post the whole code of your Random Messages system?
Reply
#7

pawn Код:
new RandomMSG[][] =
{
    "Welcome to Call of Duty 2, scripted by Hollywood (DJTunes)!",
    "The release of this script is posted on SA-MP forums.",
    "Please be sure to add reputation to DJTunes!"
};

//---[Random Messages Settings (Foward)]---//

forward SendMSG();

//---[Random Messages Settings (Settings)---//
public SendMSG()
{
    new randMSG = random(sizeof(RandomMSG));
    SendClientMessageToAll(COLOR_GREEN, RandomMSG[randMSG]);
}
pawn Код:
SetTimer("SendMSG", 120000, true);
EDIT: Should I delete all of this, and just put what you have?
Reply
#8

are you sure you have #include <a_samp> at the top of your code?
Reply
#9

pawn Код:
#include <a_samp>
#include <zcmd>
Yes. I have just deleted all of my Random Messages, and have posted yours with my settings.
I now have an additional 3 more errors (6 errors total):
pawn Код:
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(19) : error 001: expected token: "}", but found "-string-"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(22) : error 010: invalid function or declaration
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(27) : error 017: undefined symbol "random"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(27) : error 001: expected token: ";", but found "sizeof"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(27) : warning 215: expression has no effect
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(27) : error 001: expected token: ";", but found ")"
C:\Users\mom2k_000\Documents\samp03x_svr_R1-2_win32\gamemodes\cod2.pwn(27) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Reply
#10

No, I just tried that code your code in my test script and it compiled fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)