Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:makeadmin(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] < 99999)
- return AdmErrorMsg;
- new player, adminlevel;
- if(sscanf(params, "ui", player, adminlevel))
- return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}USAGE:{FFFFFF} /makeadmin [PlayerID/PartOfName] [Admin level]");
- if(!IsPlayerConnected(player))
- return SendClientMessage(playerid, COLOR_GREY, "This player is not connected.");
- printf("AdmCmd: %s has promoted %s to level %d admin.", PlayerOOCName(playerid), PlayerOOCName(player), adminlevel);
- new oadminlevel = PlayerInfo[player][pAdmin]; // Store the old admin level for the if statement
- PlayerInfo[player][pAdmin] = adminlevel; // Replace their admin level with the new admin level.
- if(adminlevel < 2)
- PlayerInfo[player][pTag] = NTAG_PLAYER;
- else PlayerInfo[playerid][pTag] = NTAG_ADMIN;
- if(adminlevel > 0)
- {
- new rand = random(9999);
- PlayerInfo[player][pSecKey] = rand;
- gAdminAuthorized[player] = 1;
- }
- new str[128];
- if(oadminlevel > adminlevel)
- {
- format(str, sizeof(str), "You have been promoted to a %s by %s, your security key is %d", GetAdminRank(player, 0),PlayerOOCName(playerid), PlayerInfo[player][pSecKey]);
- SendClientMessage(player, COLOR_LIGHTBLUE, str);
- format(str, sizeof(str), "You have promoted %s to a %s.", PlayerOOCName(player), adminlevel);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
- }
- else
- {
- format(str, sizeof(str), "You have been demoted to a %s by %s, your security key is %d", GetAdminRank(player, 0), PlayerOOCName(playerid), PlayerInfo[player][pSecKey]);
- SendClientMessage(player, COLOR_LIGHTBLUE, str);
- format(str, sizeof(str), "You have demoted %s to a %s.", PlayerOOCName(player), GetAdminRank(player, 0));
- SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
- }
- if(oadminlevel > adminlevel)
- {
- PlayerInfo[player][pAdmin] = 0;
- PlayerInfo[player][pSecKey] = 0;
- gAdminAuthorized[player] = 0;
- format(CustomTag[player], 50, "None");
- PlayerInfo[player][pTag] = NTAG_PLAYER;
- customRankName[player] = false;
- format(customRank[player], 24, "None");
- PlayerInfo[player][pBanAppealer] = 0;
- PlayerInfo[player][pGangModd] = 0;
- PlayerInfo[player][pEventModd] = 0;
- PlayerInfo[player][pComplaintModd] = 0;
- PlayerInfo[player][pShopMod] = 0;
- PlayerInfo[player][pFactionMod] = 0;
- PlayerInfo[player][pGangDirector] = 0;
- PlayerInfo[player][pBizMod] = 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement