Making admin names[Will give rep for help]
#4

How about we do it as a command using ZCMD? It would work perfectly anyway...

Here's what I mean:
pawn Код:
// This is considering you have an enum called pInfo[playerid][arank]
// This function will return the admin names
public GetAdminsName(playerid)
{
  new str[MAX_PLAYER_NAME];
  switch(pInfo[playerid][arank])
  {
    case 0: { str = "Jr. Moderator"; }
    case 1: { str = "Moderator"; }
    case 2: { str = "Admin"; }
   }
   return string;
}

// Now we will make a command using ZCMD to work with that function, and it will set a player's admin rank to
// whatever you want
CMD:makeadmin(playerid, params[]) // Command Name
{  
  if(pInfo[playerid][arank] == 0)  // Checks if Player is a Jn. Moderator
SendClientMessage(playerid, COLOR, "You are not authorized to use this command!"); // If he is, tell him he cant
  else { // if he's not...
     new targetid, Level; // targetid is the player we will make an admin
                                 // Level, is the Administrative Level you're willing to give them
     if(sscanf2(params, "ui", targetid, Level)) { SendClientMessage(playerid, COLOR, "USAGE: /makeadmin [playerid] [Admin Level]"); } // Checks parameters and sends him a correcting message
     else { // If all parameters are correct
 if(!IsPlayerConnected(targetid)) SendClientMessage(playerid, COLOR, "SERVER: Invalid ID!"); // then we check whether the player is connected or not
 else {
     new became[256], Name[MAX_PLAYER_NAME]; // Two strings, each will be used differently twice.
     pInfo[targetid][arank] = Level; // Gives Player his Administrative level
     Name = GetAdminsName(targetid); // Using the function we made earlier and getting his Rank Level
     format(became, sizeof(became), "You have been given Administrator rank of %s", Name); // use format to tell the new admin his reward
     SendClientMessage(targetid, COLOR, became); // Actually tells the new admin he became admin
     Name = GetPlayersName(targetid); // Getting the new admin's name and saving it in Name
     format(became, sizeof(became), "You have given %s, Admin rank %i", Name, Level); // telling the Old admin a message telling him he has made the new admin, admin
     SendClientMessage(playerid, COLOR, became); // actually sending him the message
   }
}
               
}
  return 1;
} // Easy right? ":)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)