Fix Errors
#1

Anyone knows how to fix these errors ?
Код:
C:\Users\Win 7\Downloads\Compressed\LSRP(48134) : error 017: undefined symbol "IsAdmin"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48137) : error 017: undefined symbol "Syntax"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48138) : error 017: undefined symbol "Error"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48139) : error 017: undefined symbol "Error"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48141) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48143) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : error 017: undefined symbol "Syntax"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48150) : error 017: undefined symbol "Error"
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48152) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48154) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48156) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Errors.
here is the command which has these errors
PHP код:
CMD:am(playeridparams[])
{
    if(
IsAdmin(playerid))
    {
        new 
toidmessage[65];
        if(
sscanf(params"us[65]"toidmessage)) return Syntax(playerid"[a]dmin[m]essage""[playerid] [message]");
        if(
strlen(message) > 65) return Error(playerid"Your message cannot be longer than 65 characters.");
        if(!
IsPlayerConnected(toid)) return Error(playerid"That player is not connected!");
        new 
string[128];
        
format(string"Admin message from %s: %s"GetPlayerNameEx(playerid), message);
        
SendClientMessageEx(toidCOLOR_GREENstring);
        
format(string"Admin %s [%d] > %s [%d]: %s"GetPlayerNameEx(playerid), playeridGetPlayerNameEx(toid), toidmessage);
        
SendAdminMessage(COLOR_GREEN,string);
    }
    else
    {
        new 
message[80];
        if(
sscanf(params"s[80]"message)) return Syntax(playerid"[a]dmin[m]essage""[message]");
        if(
strlen(message) > 80) return Error(playerid"Your message cannot be longer than 80 characters.");
        new 
string[128];
        
format(string"Admin message from %s [%d]: %s"GetPlayerNameEx(playerid), playeridmessage);
        
SendAdminMessage(COLOR_GREEN,string);
        
format(string"Your message, %s, has been sent."message);
        
SendClientMessageEx(playeridCOLOR_GREENstring);
        
format(string"Player %s [%d] > Admins: %s"GetPlayerNameEx(playerid), playeridmessage);
    }
    return 
1;

Reply
#2

pawn Код:
stock IsAdmin( playerid )
{
    if( /* CHECK IF THE PLAYER'S LEVEL IS WHAT YOU WANT.. ABOVE 1 LET'S SAY! */ ) return 1;
    return 0;
}
pawn Код:
#define Syntax(%0,%1) SendAdminMessage(%0, 0xFFFF00FF, %1);
#define Error(%0,%1) SendAdminMessage(%0, 0xFF0000FF, %1);
// CHANGE THE COLORS FOR BOTH
For the rest, you need to show us the lines.
Reply
#3

error 035: argument type mismatch (argument 2)
pawn Код:
(48149)  format(string, "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
(48151)  format(string, "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
(48160)  format(string, "Admin message from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
(48162)  format(string, "Your message, %s, has been sent.", message);
(48164)  format(string, "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message);
And can you tell me what am i supposed to change this for ?
pawn Код:
stock IsAdmin( playerid )
{
    if( /* what should i do here ? */ ) return 1;
    return 0;
}
i`m learning the basics of scripting so i dont know much
Reply
#4

You forgot the lenght. It's:
pawn Код:
format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
// Do the rest like that!
Yes, you want to check if a player is admin. You need to store the player's level somewhere. If you do, then check if his level is greater or equal to a number, then that player is admin. Otherwise, he is not.
Reply
#5

Now i got these new Errors and Warnings
Код:
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48141) : warning 206: redundant test: constant expression is non-zero
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : warning 209: function "SendAdminMessage" should return a value
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48150) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48150) : warning 209: function "SendAdminMessage" should return a value
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48150) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48151) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48151) : warning 209: function "SendAdminMessage" should return a value
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48151) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48161) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48161) : warning 209: function "SendAdminMessage" should return a value
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48161) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48162) : error 035: argument type mismatch (argument 2)
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48162) : warning 209: function "SendAdminMessage" should return a value
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48162) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
The Lines:
pawn Код:
(48141)  if(playerid, 1) return 1; // i didnt know what should i type here
(48149)  if(sscanf(params, "us[65]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage", "[playerid] [message]");
(48150)  if(strlen(message) > 65) return Error(playerid, "Your message cannot be longer than 65 characters.");
(48151)  if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
(48161)  if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[a]dmin[m]essage", "[message]");
(48162)  if(strlen(message) > 80) return Error(playerid, "Your message cannot be longer than 80 characters.");
Reply
#6

i fixed this line
pawn Код:
(48141)  if(PlayerInfo[playerid][pLevel]>=1) return 1;
but still cant fix the errors
Reply
#7

i belive that these defines are the problem
pawn Код:
#define Syntax(%0,%1) SendAdminMessage(%0, 0xFFFF00FF, %1);
#define Error(%0,%1) SendAdminMessage(%0, 0xFF0000FF, %1);
Can you help me fixing it ?
Reply
#8

My apologies. Change to:
pawn Код:
#define Syntax(%0,%1) SendClientMessage(%0, 0xFFFF00FF, %1);
#define Error(%0,%1) SendClientMessage(%0, 0xFF0000FF, %1);
I wrote Admin by accident while reading the code.
Reply
#9

Errr...Now i got these errors and warns
Код:
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : warning 202: number of arguments does not match definition
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48149) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48150) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48151) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48161) : warning 202: number of arguments does not match definition
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48161) : error 036: empty statement
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48162) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#10

Change to:
pawn Код:
#define Syntax(%0,%1) SendClientMessage(%0, 0xFFFF00FF, %1)
#define Error(%0,%1) SendClientMessage(%0, 0xFF0000FF, %1)
I accidentally used semicolon at the end. And look here:
pawn Код:
if(sscanf(params, "us[65]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage", "[playerid] [message]");
if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[a]dmin[m]essage", "[message]");
You're using "message", "message". The SendClientMessage function has 3 parameters and you're using 4.

Change to:
pawn Код:
if(sscanf(params, "us[65]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage: [playerid] [message]");
if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[a]dmin[m]essage: [message]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)