#1

it don't show the player name olny the admin can warn look wat it say:
Test has been warned by admin Test (1/3) - Reason: test
it say it to 2 times. how to make like dis
Testing has been warned by admin Test50 (1/3) - Reason: test

Код:
CMD:warn(playerid, params[])
{
    new PlayerToKick;
    new
        iPlayer,
        szReason[ 128 ]
    ;
    if (APlayerData[playerid][PlayerLevel] >= 1)
    if( sscanf( params, "iS(None specified)[128]", iPlayer, szReason ))
        return SendClientMessage( playerid, 0xFF0000AA, "[USAGE] /warn [playerid] [reason]" );

    g_iWarnings[ iPlayer ] ++;

    if( g_iWarnings[ iPlayer ] > 2 ) // 3 warnings
    {
        // Kick player or whatever you want (and send messages)
        Kick(PlayerToKick);
    }
    else // 1 or 2 warnings
    {
        new
            iName[ MAX_PLAYER_NAME ]
        ;
        GetPlayerName( playerid, iName, MAX_PLAYER_NAME );
        format( szReason, sizeof( szReason ), "%s has been warned by admin %s (%i/3)%s%s", iName,FormatName(playerid), g_iWarnings[ iPlayer ], ( isnull( szReason ) ? ("") : (" - Reason: ") ), szReason );
        SendClientMessageToAll( 0xFFFF00FF, szReason );
    }
    return true;
}
Reply
#2

PHP код:
CMD:warn(playeridparams[])
{
    new 
PlayerToKick;
    new
        
iPlayer,
        
szReason128 ]
    ;
    if (
APlayerData[playerid][PlayerLevel] >= 1)
    if( 
sscanfparams"iS(None specified)[128]"iPlayerszReason ))
        return 
SendClientMessageplayerid0xFF0000AA"[USAGE] /warn [playerid] [reason]" );
    
g_iWarningsiPlayer ] ++;
    if( 
g_iWarningsiPlayer ] > // 3 warnings
    
{
        
// Kick player or whatever you want (and send messages)
        
Kick(PlayerToKick);
    }
    else 
// 1 or 2 warnings
    
{
        new
            
iNameMAX_PLAYER_NAME ]
        ;
        
GetPlayerNameiPlayeriNameMAX_PLAYER_NAME );  // Here is the error tapeworms playerid instead of iPlayer
        
formatszReasonsizeofszReason ), "%s has been warned by admin %s (%i/3)%s%s"iName,FormatName(playerid), g_iWarningsiPlayer ], ( isnullszReason ) ? ("") : (" - Reason: ") ), szReason );
        
SendClientMessageToAll0xFFFF00FFszReason );
    }
    return 
true;

Reply
#3

Quote:
Originally Posted by cesar_******
Посмотреть сообщение
PHP код:
CMD:warn(playeridparams[])
{
    new 
PlayerToKick;
    new
        
iPlayer,
        
szReason128 ]
    ;
    if (
APlayerData[playerid][PlayerLevel] >= 1)
    if( 
sscanfparams"iS(None specified)[128]"iPlayerszReason ))
        return 
SendClientMessageplayerid0xFF0000AA"[USAGE] /warn [playerid] [reason]" );
    
g_iWarningsiPlayer ] ++;
    if( 
g_iWarningsiPlayer ] > // 3 warnings
    
{
        
// Kick player or whatever you want (and send messages)
        
Kick(PlayerToKick);
    }
    else 
// 1 or 2 warnings
    
{
        new
            
iNameMAX_PLAYER_NAME ]
        ;
        
GetPlayerNameiPlayeriNameMAX_PLAYER_NAME );  // Here is the error tapeworms playerid instead of iPlayer
        
formatszReasonsizeofszReason ), "%s has been warned by admin %s (%i/3)%s%s"iName,FormatName(playerid), g_iWarningsiPlayer ], ( isnullszReason ) ? ("") : (" - Reason: ") ), szReason );
        
SendClientMessageToAll0xFFFF00FFszReason );
    }
    return 
true;

cesar, can I use this code in any FS or I need some extra thing? Yes the #include <sscanf2> I know but anything else?
Reply
#4

Quote:
Originally Posted by Lauder
Посмотреть сообщение
cesar, can I use this code in any FS or I need some extra thing? Yes the #include <sscanf2> I know but anything else?
need replacing variables by having your server.
Reply
#5

Quote:
Originally Posted by cesar_******
Посмотреть сообщение
need replacing variables by having your server.
sent you a PM.
Reply
#6

People, put the code in brackets!

pawn Код:
if (APlayerData[playerid][PlayerLevel] >= 1)
This statement will only work for the sscanf.
Reply
#7

I love how no-one has spotted the actual problem yet.

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
pawn Код:
if( sscanf( params, "iS(None specified)[128]", iPlayer, szReason ))
pawn Код:
Kick(PlayerToKick);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)