SHARE
TWEET

Untitled

a guest Jun 25th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMD:makeadmin(playerid, params[])
  2. {
  3.     if(PlayerInfo[playerid][pAdmin] < 99999)
  4.         return AdmErrorMsg;
  5.  
  6.     new player, adminlevel;
  7.     if(sscanf(params, "ui", player, adminlevel))
  8.         return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}USAGE:{FFFFFF} /makeadmin [PlayerID/PartOfName] [Admin level]");
  9.  
  10.     if(!IsPlayerConnected(player))
  11.         return SendClientMessage(playerid, COLOR_GREY, "This player is not connected.");
  12.  
  13.     printf("AdmCmd: %s has promoted %s to level %d admin.", PlayerOOCName(playerid), PlayerOOCName(player), adminlevel);
  14.  
  15.     new oadminlevel = PlayerInfo[player][pAdmin]; // Store the old admin level for the if statement
  16.     PlayerInfo[player][pAdmin] = adminlevel; // Replace their admin level with the new admin level.
  17.  
  18.     if(adminlevel < 2)
  19.         PlayerInfo[player][pTag] = NTAG_PLAYER;
  20.         else PlayerInfo[playerid][pTag] = NTAG_ADMIN;
  21.    
  22.     if(adminlevel > 0)
  23.     {
  24.         new rand = random(9999);
  25.         PlayerInfo[player][pSecKey] = rand;
  26.         gAdminAuthorized[player] = 1;
  27.     }
  28.  
  29.     new str[128];
  30.     if(oadminlevel > adminlevel)
  31.     {
  32.         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]);
  33.         SendClientMessage(player, COLOR_LIGHTBLUE, str);
  34.  
  35.         format(str, sizeof(str), "You have promoted %s to a %s.", PlayerOOCName(player), adminlevel);
  36.         SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  37.     }
  38.     else
  39.     {
  40.         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]);
  41.         SendClientMessage(player, COLOR_LIGHTBLUE, str);
  42.  
  43.         format(str, sizeof(str), "You have demoted %s to a %s.", PlayerOOCName(player), GetAdminRank(player, 0));
  44.         SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
  45.     }
  46.  
  47.     if(oadminlevel > adminlevel)
  48.     {
  49.         PlayerInfo[player][pAdmin] = 0;
  50.         PlayerInfo[player][pSecKey] = 0;
  51.         gAdminAuthorized[player] = 0;
  52.         format(CustomTag[player], 50, "None");
  53.         PlayerInfo[player][pTag] = NTAG_PLAYER;
  54.         customRankName[player] = false;
  55.         format(customRank[player], 24, "None");
  56.         PlayerInfo[player][pBanAppealer] = 0;
  57.         PlayerInfo[player][pGangModd] = 0;
  58.         PlayerInfo[player][pEventModd] = 0;
  59.         PlayerInfo[player][pComplaintModd] = 0;
  60.         PlayerInfo[player][pShopMod] = 0;
  61.         PlayerInfo[player][pFactionMod] = 0;
  62.         PlayerInfo[player][pGangDirector] = 0;
  63.         PlayerInfo[player][pBizMod] = 0;
  64.     }
  65.     return 1;
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top