Help: /warn cmd don't show a reason
#1

Hello!

I have a problem...

I have this code, but it doesn't show a reason...Can someone fix it?

CODE

PHP код:
CMD:warn(playeridparams[])
{
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1)return SendClientMessage(playeridCOLOR_RED"You are not allowed to use this command!");
    new 
pIDstring[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason;
    if(
sscanf(params"u"pID))return SendClientMessage(playeridCOLOR_ORANGE"Usage: /warn [playerid] [reason]");
    if(
sscanf(params"u"reason))return SendClientMessage(playeridCOLOR_ORANGE"Usage: /warn [playerid] [reason]");
    if(!
IsPlayerConnected(pID))return SendClientMessage(playeridCOLOR_RED"ERROR: This player is not connected.");
    {
    
playerWarn[pID] ++;
    
GetPlayerName(playeridpNamesizeof pName);
    
GetPlayerName(pIDnamesizeof name);
    
format(stringsizeof string"[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3."pNamereasonplayerWarn[pID]);
    
SendClientMessage(pIDCOLOR_YELLOWstring);
    
format(stringsizeof string"[SYSTEM]: You warned a player %s for %s. Total warnings %i/3."namereasonplayerWarn[pID]);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    if(
playerWarn[pID] > 2)
    {
    
format(stringsizeof string"[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s."namereason);
    
SendClientMessageToAll(COLOR_YELLOWstring);
    
SendClientMessage(pIDCOLOR_YELLOW"[KICK]: You were warned three (3) times and got kicked.");
    
Kick(pID);
    
KickLog(string);
    }
    }
    return 
1;

Thank you for your help
Reply
#2

Try This:
pawn Код:
CMD:warn(playerid, params[])
{

    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new pID, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[60];
    if(sscanf(params, "us[60]", pID,reason))return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /warn [playerid] [reason]");
    if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    {
    playerWarn[pID] ++;
    GetPlayerName(playerid, pName, sizeof pName);
    GetPlayerName(pID, name, sizeof name);
    format(string, sizeof string, "[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3.", pName, reason, playerWarn[pID]);
    SendClientMessage(pID, COLOR_YELLOW, string);
    format(string, sizeof string, "[SYSTEM]: You warned a player %s for %s. Total warnings %i/3.", name, reason, playerWarn[pID]);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    if(playerWarn[pID] > 2)
    {
    format(string, sizeof string, "[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s.", name, reason);
    SendClientMessageToAll(COLOR_YELLOW, string);
    SendClientMessage(pID, COLOR_YELLOW, "[KICK]: You were warned three (3) times and got kicked.");
    Kick(pID);
    KickLog(string);
    }
    }
    return 1;
}
Reply
#3

pawn Код:
CMD:warn(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new pID, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[64];
    if(sscanf(params, "us[64]", pID, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /warn [playerid] [reason]");
    if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    {
        playerWarn[pID] ++;
        GetPlayerName(playerid, pName, sizeof pName);
        GetPlayerName(pID, name, sizeof name);
        format(string, sizeof string, "[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3.", pName, reason, playerWarn[pID]);
        SendClientMessage(pID, COLOR_YELLOW, string);
        format(string, sizeof string, "[SYSTEM]: You warned a player %s for %s. Total warnings %i/3.", name, reason, playerWarn[pID]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        if(playerWarn[pID] > 2)
        {
            format(string, sizeof string, "[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s.", name, reason);
            SendClientMessageToAll(COLOR_YELLOW, string);
            SendClientMessage(pID, COLOR_YELLOW, "[KICK]: You were warned three (3) times and got kicked.");
            Kick(pID);
            KickLog(string);
        }
    }
    return 1;
}
EDIT: Too late.
Reply
#4

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
Try This:
pawn Код:
CMD:warn(playerid, params[])
{

    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1)return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    new pID, string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], reason[60];
    if(sscanf(params, "us[60]", pID,reason))return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /warn [playerid] [reason]");
    if(!IsPlayerConnected(pID))return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected.");
    {
    playerWarn[pID] ++;
    GetPlayerName(playerid, pName, sizeof pName);
    GetPlayerName(pID, name, sizeof name);
    format(string, sizeof string, "[SYSTEM]: Administrator %s warned you for %s. Total warnings %i/3.", pName, reason, playerWarn[pID]);
    SendClientMessage(pID, COLOR_YELLOW, string);
    format(string, sizeof string, "[SYSTEM]: You warned a player %s for %s. Total warnings %i/3.", name, reason, playerWarn[pID]);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    if(playerWarn[pID] > 2)
    {
    format(string, sizeof string, "[KICK]: %s recived 3 warnings and got kicked from the server. Reason: %s.", name, reason);
    SendClientMessageToAll(COLOR_YELLOW, string);
    SendClientMessage(pID, COLOR_YELLOW, "[KICK]: You were warned three (3) times and got kicked.");
    Kick(pID);
    KickLog(string);
    }
    }
    return 1;
}
Thanks, It's working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)