Jump to content

Recommended Posts

Posted

Cum pot face in asa fel incat sa nu mai poata da adminii de nivel 1 /makeadmin? Vreau doar adminii 5+ sa o poata faca. Ziceti-mi va rog clar pas cu pas cum trebuie sa fac sa rezolv ca nu le prea am cu limbajul pawno... Is asa la inceput si vreau sa invat.

 

CMD:makeadmin(playerid, params[])
{
 if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
 if(IsPlayerConnected(playerid))
 {
  if (PlayerInfo[playerid][pAdmin] >= 6 || EstiFondator(playerid))

  {
   new id,adminlevel,sendername[30],giveplayer[30],string[200],escape[200];
   if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, COLOR_WHITE, "Scrie: /makeadmin <Name/Playerid> <Admin Level>");
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "Nu esti autorizat sa folosesti comanda.");
   if(PlayerInfo[id][pAdmin] >= 6 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Nu poti modifica admin level-ul unui admin 6+!.");
   if(adminlevel > 4 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Only founders can make admin higher than 4.");
   if(IsPlayerConnected(id))
   {
       if(id != INVALID_PLAYER_ID)
       {
     GetPlayerName(id, giveplayer, sizeof(giveplayer));
     GetPlayerName(playerid, sendername, sizeof(sendername));
     printf("({FF6347}AdminStaff{FFFFFF}) %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
     format(string, sizeof(string), "You've been promoted to level %d admin, by %s.", adminlevel, sendername);
     SendClientMessage(id, COLOR_WHITE, string);
     format(string, sizeof(string), "You have promoted %s to a level %d admin.", giveplayer,adminlevel);
     SendClientMessage(playerid, COLOR_YELLOW, string);
     format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,giveplayer,adminlevel);
     ABroadCast(COLOR_ADMCHAT,string,1);
     HLChat(COLOR_ADMCHAT,string);
     mysql_real_escape_string(string, escape);
     PlayerInfo[id][pAdmin] = adminlevel;
     if(adminlevel == 0)
     {
      AdminDuty[id] = 0;
     }
     new str[256];
     mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Admin`='%d' WHERE `name`='%s'",PlayerInfo[id][pAdmin],PlayerInfo[id][pNormalName]);
     mysql_tquery(SQL,str,"","");
     mysql_format(SQL,str, sizeof(str), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
     mysql_tquery(SQL,str,"","");
    }
   }
      else
      {
       SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
      }
  }
  else
  {
   SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You need admin 6+ to use this.");
  }
 }
 return 1;
}

g4JGBJX.gif.31953391ab64171df562293ad37a0875.gif

Posted

CMD:makeadmin(playerid, params[])
{
 if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
 if(IsPlayerConnected(playerid))
 {
  if (PlayerInfo[playerid][pAdmin] >= 5)

  {
   new id,adminlevel,sendername[30],giveplayer[30],string[200],escape[200];
   if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, COLOR_WHITE, "Scrie: /makeadmin <Name/Playerid> <Admin Level>");
   if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_RED, "Nu esti autorizat sa folosesti comanda.");
   if(PlayerInfo[id][pAdmin] >= 6 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Nu poti modifica admin level-ul unui admin 6+!.");
   if(adminlevel > 4 && !EstiFondator(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Only founders can make admin higher than 4.");
   if(IsPlayerConnected(id))
   {
       if(id != INVALID_PLAYER_ID)
       {
     GetPlayerName(id, giveplayer, sizeof(giveplayer));
     GetPlayerName(playerid, sendername, sizeof(sendername));
     printf("({FF6347}AdminStaff{FFFFFF}) %s has promoted %s to a level %d admin.", sendername, giveplayer, adminlevel);
     format(string, sizeof(string), "You've been promoted to level %d admin, by %s.", adminlevel, sendername);
     SendClientMessage(id, COLOR_WHITE, string);
     format(string, sizeof(string), "You have promoted %s to a level %d admin.", giveplayer,adminlevel);
     SendClientMessage(playerid, COLOR_YELLOW, string);
     format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,giveplayer,adminlevel);
     ABroadCast(COLOR_ADMCHAT,string,1);
     HLChat(COLOR_ADMCHAT,string);
     mysql_real_escape_string(string, escape);
     PlayerInfo[id][pAdmin] = adminlevel;
     if(adminlevel == 0)
     {
      AdminDuty[id] = 0;
     }
     new str[256];
     mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Admin`='%d' WHERE `name`='%s'",PlayerInfo[id][pAdmin],PlayerInfo[id][pNormalName]);
     mysql_tquery(SQL,str,"","");
     mysql_format(SQL,str, sizeof(str), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
     mysql_tquery(SQL,str,"","");
    }
   }
      else
      {
       SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
      }
  }
  else
  {
   SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You need admin 6+ to use this.");
  }
 }
 return 1;
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.