return SendClientMessage doesn't work.
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
This should work more to your liking:

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 99999 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command!");
    new iAdminValue, iTargetID;
    if(sscanf(params, "ui", iTargetID, iAdminValue))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
        SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
        SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
        return 1;
    }
    if(iTargetID == INVALID_PLAYER_ID || !IsPlayerConnected(iTargetID)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
    switch(iAdminValue)
    {
        case 0 .. 4, 1337, 1338, 99998, 99999: {}
        default: return SendClientMessage(playerid, COLOR_WHITE, "You must enter a valid level (0 - 4, 1337 - 1138 or 99998 - 99999)");
    }
    if(PlayerInfo[playerid][pAdmin] < 99999 && iAdminValue >= 99998) return SendClientMessage(playerid, COLOR_WHITE, "You can't set a player's admin level to 99998 or higher. Only Server Owners can do that!");
    if(PlayerInfo[iTargetID][pAdmin] == iAdminValue) return SendClientMessage(playerid, COLOR_WHITE, "That player is already that Administrator level.");
    if(!iAdminValue)
    {
        new you[128];
        format(you, sizeof(you), "You removed %s from the Administrator Team", GetPlayerNameEx(iTargetID));
        SendClientMessage(playerid, COLOR_WHITE, you);
        format(you, sizeof(you), "You have been removed from the Administrator Team by Administrator %s", GetPlayerNameEx(playerid));
        SendClientMessage(iTargetID, COLOR_LIGHTBLUE, you);
        format(you, sizeof(you), "Administrator %s has been removed from the Administrator Team. They are no longer an Administrator!", GetPlayerNameEx(iTargetID));
        SendClientMessageToAll(COLOR_PINK, you);
        return 1;
    }
    else
    {
        new newsinfo[128];
        if(!PlayerInfo[iTargetID][pAdmin])
        {
            format(newsinfo, sizeof(newsinfo), "You have added %s into the Administrator Team", GetPlayerNameEx(iTargetID));
            SendClientMessage(playerid, COLOR_REALRED, newsinfo);
            format(newsinfo, sizeof(newsinfo), "Congratulations! You are now on the Administrator Team! Added by Administrator %s (type /ah for admin helps)", GetPlayerNameEx(playerid));
            SendClientMessage(iTargetID, COLOR_YELLOW, newsinfo);
            format(newsinfo, sizeof(newsinfo), "Welcome to our newest Administrator %s. They are here to protect our server and to improve your experince here!", GetPlayerNameEx(iTargetID));
            SendClientMessageToAll(COLOR_REALRED, newsinfo);
        }
        new rankshift[10];
        rankshift = (PlayerInfo[iTargetID][pAdmin] < iAdminValue) ? ("promoted") : ("demoted");
        format(newsinfo, sizeof(newsinfo), "AdmCmd: %s has %s %s to a level %d admin.", GetPlayerNameEx(playerid), rankshift, GetPlayerNameEx(iTargetID), iAdminValue);
        ABroadCast(COLOR_LIGHTRED, newsinfo, 2);
        format(newsinfo, sizeof(newsinfo), "You have been %s to a level %d admin by %s.", rankshift, iAdminValue, GetPlayerNameEx(playerid));
        SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, newsinfo);
        format(newsinfo, sizeof(newsinfo), "You have %s %s to a level %d admin.", rankshift, GetPlayerNameEx(iTargetID), iAdminValue);
        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, newsinfo);
    }
    PlayerInfo[iTargetID][pAdmin] = iAdminValue;
    return 1;
}
Thank you so much for that "promoted, demoted" rankshift!!! i will try it out
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)