I can only use commands on myself even if i enter a different id
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 9999) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    new iAdminValue, iTargetID;
    if(sscanf(params, "ui", iTargetID, iAdminValue)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
    if(!IsPlayerConnected(iTargetID) || iTargetID == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
    if(PlayerInfo[iTargetID][pHelper] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make a Community Helper an Administrator!");
    new szMessage[100];
    PlayerInfo[iTargetID][pAdmin] = iAdminValue;
    //Save Player's Stats here if necessary.
    format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
    ABroadCast(COLOR_LIGHTRED,szMessage, 2);
    format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
    SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
    format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
    return 1;
}
If this doesn't work, you need to update your sscanf.
Okay, I will update my sscanf when I wake up tomorrow and will reply with the results tomorrow.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)