10.04.2013, 21:27
Hi I'm using a /report command but I got this errors: (code by LizarI not me)
The COMMAND:
The errors:
Error lines:
Thank you
The COMMAND:
pawn Код:
CMD:report(playerid, params[])
{
new
iPlayer,
szReport[ 128 ]
// 118 cells (117 characters) is the maximum length for the report,
// but we're going to add stuff to the string (using format), so because
// of that, I'm making it 128 cells.
;
if( sscanf( params, "rs[118]", iPlayer, iReport ))
{
SendClientMessage( playerid, 0xFFFF00AA, "[USAGE] {FFFFFF}/report [playerid/name] [reason]" );
}
else if( strlen( iReport ) < 3 )) // Two letter long reports aren't really useful, now are they?
{
SendClientMessage( playerid, 0xFF0000AA, "[ERROR] {FFFFFF}The report has to be at least 3 letters long." );
}
else
{
new
szMessage[ 128 ], // We need another string to be able to fit the name and ID of the reporter,
szName[ MAX_PLAYER_NAME + 1 ] // I'm only making one of this, because we can store the other player's name in the szMessage variable
;
GetPlayerName( playerid, szMessage, sizeof( szName ));
GetPlayerName( iPlayer, szName, sizeof( szName ) );
format( szMessage, sizeof( szMessage ), "[REPORT] {FFFFFF}%s(ID: %d) has reported %s(ID: %d) for:", szMessage, playerid, szName, iPlayer );
strins( szReport, "[REPORT] {FFFFFF}", 0 );
foreach( Player, i )
{
if( IsPlayerAdmin( i )) // Add '|| myAdminVariable[ i ]' if you have a custom admin level system
{
SendClientMessage( i, 0xFF0000AA, szMessage );
SendClientMessage( i, 0xFF0000AA, szReport );
}
}
SendClientMessage( playerid, 0x00FF00AA, "[SUCCESS] Report sent to all online admins." );
}
return true;
}
Код:
.pwn(1549) : error 017: undefined symbol "iReport" .pwn(1553) : error 017: undefined symbol "iReport" .pwn(1553) : error 029: invalid expression, assumed zero .pwn(1557) : error 029: invalid expression, assumed zero Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Код:
if( sscanf( params, "rs[118]", iPlayer, iReport )) << Line 1549 else if( strlen( iReport ) < 3 )) << Line 1553 else if( strlen( iReport ) < 3 )) << Line 1553 again else << Line 1557 (LOL jus "else" :confused:)