Easy coding help!
#1

What's up? I have not been scripting for some months and I forgot alot, anyways when I try to execute this command I get "Invalid player ID" even tought it's the right one.

Code:
CMD:makeadmin(playerid, params[])
{
    new pID, value;
    if(PlayerInfo[playerid][pAdmin] < 1338 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
    else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /makeadmin [playerid/partofname] [level 1-1338].");
    else if (value < 0 || value > 1338) return SendClientMessage(playerid, COLOR_RED, "Unknown level! Only 0 to 1338.");
    else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED,"Invalid player id.");
    else {
        new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        GetPlayerName(pID, tName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
        SCM(playerid, COLOR_GREEN, string);
        format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
        SCM(pID, COLOR_GREEN, string);
        PlayerInfo[pID][pAdmin] = value;
    }
    return 1;
}
Reply


Messages In This Thread
Easy coding help! - by Chrillzen - 02.02.2012, 13:44
Re: Easy coding help! - by milanosie - 02.02.2012, 14:16
Re: Easy coding help! - by 2KY - 02.02.2012, 14:17

Forum Jump:


Users browsing this thread: 2 Guest(s)