SScanf problems ( i think )
#1

Hi a nice guy made the radio thingy in the script request topic, I have never tried sscanf before and I've never seen these errors before now, could any tell me what i need?

I added all these codes, the right places. ( And i have the pawno include sscanf V2 ( i just downloaded it )

The command where the errors is at

Code:
#define PLAYERS 20  // Make a new define which is just the amount of player slots on your server
// Instead of MAX_PLAYERS which is 500 use your OWN define above
new Freq[PLAYERS]=0; // For storing the frequency data for each player

//OnPlayerCommandText
dcmd(setfreq, 7, cmdtext); // setfreq is just easier change it if you want but remember to change the size aswell
dcmd(radio, 5, cmdtext);

//After OnPlayerCommandText
dcmd_setfreq(playerid, params[])
{
new frq;
if(!sscanf(params, "d", frq))
{
Freq[playerid] = frq;
  SendClientMessage(playerid, ORANGE, "Your frequency has been changed!"); // I could make a format but i can't be arsed
}
else SendClientMessage(playerid, YELLOW, "Usage: /setfreq [frequency]"); // player didnt type anything
return 1;
}
dcmd_radio(playerid, params[])
{
new msg;
if(!sscanf(params, "s", message))
{
  for(new a=0;a<PLAYERS;a++)
  {
    if(Freq[a] == Freq[playerid])
    {
SendFormatToAll(0x00ff00aa, "[RADIO]%s: %sd", msg, GetName(playerid));
    }
  }
}
else SendClientMessage(playerid, YELLOW, "Usage: /radio [message]"); // player didnt type anything
return 1;
}
Defines
Code:
//DCMD this is used for the command and I would advise using it in future if you don't already!
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//These are defines for messages, they are a lot easier than writing the whole thing and it isn't any less efficient
#define SendMsg(%0,%1,%2) SendClientMessage(%0,%1,%2)
#define SendMsgAll(%0,%1) SendClientMessageToAll(%0,%1)

#define SendFormat(%0,%1,%2,%3) do{new _str[128];format(_str,128,%2,%3);SendClientMessage(%0,%1,_str);}while(FALSE)
#define SendFormatToAll(%1,%2,%3) do{new _str[128];format(_str,128,%2,%3);SendClientMessageToAll(%1,_str);}while(FALSE)
Stock
My errors are these -

C:\Users\Dave\Desktop\Dahwut.pwn(27580) : error 017: undefined symbol "FALSE"

SendFormatToAll(0x00ff00aa, "[RADIO]%s: %sd", msg, GetName(playerid)); // 27580
Reply
#2

Quote:
Originally Posted by Y_Leѕѕ
That's a problem with your "SendFormat" macro, not sscanf. At the top of your code do this:

pawn Code:
new bool:FALSE = false;
The only reason sscanf could cause this issue is if you just upgraded from v1 to v2, I believe the old version used, and thus defined, the FALSE variable, the new version doesn't use, and thus doesn't define, it.
Thank you Y_Less, that fixed the errors
Reply
#3

Nvm fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)