PDA

View Full Version : Errors


saffierr
28/03/2015, 10:25 PM
I got errors, and I don't know how to fix them. I've been trying to fix it for 1hour...

CMD:kick(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new targetplayer, reason[64];
if(sscanf(params, "is[64]", targetplayer, reason))
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [ID] [REASON]");
}
if(targetplayer == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You kicked X");
SendClientMessage(targetplayer, COLOR_RED, "You have been kicked by admin X for REASON");
Kick(targetplayer);
}
}
else
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
return 1;
}
Errors: C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(369) : error 017: undefined symbol "sscanf"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(368) : warning 203: symbol is never used: "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(368 -- 372) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(379) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(380) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(383) : error 010: invalid function or declaration
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(387) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.

Scrillex
28/03/2015, 10:27 PM
Do you have sscanf2 include defined??

SaintMikey
28/03/2015, 10:28 PM
Check the line, and read what the error has said.

saffierr
28/03/2015, 10:47 PM
I don't have any sscanf .inc , forgot that.
Can someone share the sscanf .inc ?

Dorito
28/03/2015, 11:02 PM
I don't have any sscanf .inc , forgot that.
Can someone share the sscanf .inc ?

http://forum.sa-mp.com/showthread.php?t=120356
#include <sscanf2>

saffierr
28/03/2015, 11:31 PM
I downloaded it, and extracted it into pawno includes, and in plugins.
.. still errors

CalvinC
29/03/2015, 08:45 AM
You need to include it in your script by doing #include <sscanf2> in the top of your script.

saffierr
29/03/2015, 05:38 PM
Oh yeah, forgot to #include that.
I did it, the following errors I receive are:
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(389) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(396) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(397) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(400) : error 010: invalid function or declaration
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(404) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

JaydenJason
29/03/2015, 05:41 PM
wop nvm

saffierr
29/03/2015, 06:02 PM
Can someone explain me why I got those errors?

CalvinC
29/03/2015, 06:05 PM
Can you show the lines?

saffierr
29/03/2015, 06:07 PM
381:CMD:kick(playerid, params[])
382:{
383: if(IsPlayerAdmin(playerid))
384: {
385: new targetplayer, reason[64];
386: if(sscanf(params, "is[64]", targetplayer, reason))
387: SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [ID] [REASON]");
388: }
389: if(targetplayer == playerid)
390: {
391: SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
392: }
393: else
394: {
395: SendClientMessage(playerid, COLOR_RED, "You kicked X");
396: SendClientMessage(targetplayer, COLOR_RED, "You have been kicked by admin X for REASON");
397: Kick(targetplayer);
398: }
399: }
400: else
401: {
402: SendClientMessage(playerid, -1, "SERVER: Unknown command.");
403: }
404: return 1;
405:}
ERRORS:
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(389) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(396) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(397) : error 017: undefined symbol "targetplayer"
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(400) : error 010: invalid function or declaration
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(404) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

CoachCarter
29/03/2015, 06:14 PM
CMD:kick(playerid, params[])
{
new targetplayer, reason[64];
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "is[64]", targetplayer, reason))
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [ID] [REASON]");
}
if(targetplayer == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You kicked X");
SendClientMessage(targetplayer, COLOR_RED, "You have been kicked by admin X for REASON");
Kick(targetplayer);
}
}
else
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
return 1;
}




Try this

saffierr
29/03/2015, 06:19 PM
Oh lol, You just have the new targetplayer, reason[64] in front of everything.

ok step in the good direction.
I got 2 errors left:
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(401) : error 010: invalid function or declaration
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(405) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

CalvinC
29/03/2015, 06:39 PM
If you had correct indentation, you could see the problem with your braces:
CMD:kick(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new targetplayer, reason[64];
if(sscanf(params, "is[64]", targetplayer, reason))
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [ID] [REASON]");
}
if(targetplayer == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You kicked X");
SendClientMessage(targetplayer, COLOR_RED, "You have been kicked by admin X for REASON");
Kick(targetplayer);
}
}
else
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
return 1;
}
Use it like this:
CMD:kick(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new targetplayer, reason[64];
if(sscanf(params, "is[64]", targetplayer, reason))
{
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [ID] [REASON]");
return 1; // Use return to stop the command if the player didn't specify ID and Reason
}
if(targetplayer == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot kick yourself!");
return 1; // Use return to stop the command if the targetplayer is the playerid
}
else
{
SendClientMessage(playerid, COLOR_RED, "You kicked X");
SendClientMessage(targetplayer, COLOR_RED, "You have been kicked by admin X for REASON");
// You have to use format to format a string and display the targetplayer's name, and the reason
Kick(targetplayer);
}
}
else
{
return 0; // Return 0 will give the unknown command message
}
return 1;
}
Fixed some other stuff as well which i commented.