SA-MP Forums Archive
/makeadmin command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /makeadmin command (/showthread.php?tid=133397)



/makeadmin command - [TW]randomguy - 12.03.2010

Hello,

I have made a command /makeadmin, so admins can make othe people admins. Here is the code:

Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/makeadmin", true) == 0)
{
    new string[128];
    new tmp[256];
    new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
    new giveplayerid;
    if (IsPlayerAdmin(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level]");
            SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin.");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        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 thanks to %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 an active player.", giveplayerid);
            SendClientMessage(playerid, 0xE60000FF, string);
        }
    }
    else
    {
      SendClientMessage(playerid, 0xE60000FF, "You are not a head admin!");
    }
    return 1;
}



Re: /makeadmin command - [HiC]TheKiller - 12.03.2010

Did you just copy and paste that?


Re: /makeadmin command - Mike Garber - 12.03.2010

So?
What's your problem?


Re: /makeadmin command - XRVX - 12.03.2010

i think he releases this?!