HELP! +REP
#2

Try This
pawn Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/makeadmin", true) == 0)
{
    new string[128];
   
    new tmp[256];
    tmp = strtok(cmdtext, idx);
   
    new ReturnUser;
    new giveplayerid;
    new player[MAX_PLAYER_NAME];
   
    new giveplayer[MAX_PLAYER_NAME];
    giveplayerid = ReturnUser(tmp);
    if (IsPlayerAdmin(playerid))
    {
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /makeadmin [playerid] [level]");
        SendClientMessage(playerid, COLOUR_ORANGE, "FUNCTION: Player will obtain admin.");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    new level = strval(tmp);
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, player, sizeof(player));
        PlayerInfo[giveplayerid][AdminLevel] = level;
        printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
        format(string, sizeof(string), "You are now an administrator level %d given by %s.", level,  player);
        SendClientMessage(giveplayerid, 0x00C2ECFF, string);
        format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
       SendClientMessage(playerid, 0x00C2ECFF, string);
    }
    else if(giveplayerid == INVALID_PLAYER_ID)
    {
        format(string, sizeof(string), "%i is not currently on the server.", giveplayerid);
        SendClientMessage(playerid, 0xE60000FF, string);
    }
    }
    else
    {
        SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin, or an owner!");
    }
    return 1;
    }
    return 0;
}
Reply


Messages In This Thread
HELP! +REP - by DJTunes - 03.01.2013, 18:07
Re: HELP! +REP - by Patrick - 03.01.2013, 18:12
Re : HELP! +REP - by DaRk_RaiN - 03.01.2013, 18:14
Re: Re : HELP! +REP - by DJTunes - 03.01.2013, 18:18
Re: HELP! +REP - by DJTunes - 03.01.2013, 18:20
Re: HELP! +REP - by Konstantinos - 03.01.2013, 18:23
Re: HELP! +REP - by DJTunes - 03.01.2013, 18:28
Re: HELP! +REP - by DJTunes - 03.01.2013, 19:08
Re: HELP! +REP - by Konstantinos - 03.01.2013, 21:06
Re: HELP! +REP - by Chrillzen - 03.01.2013, 21:12

Forum Jump:


Users browsing this thread: 3 Guest(s)