Quote:
Originally Posted by BigETI
How did this even compile? There should be atleast a "switch" statement.
|
I forgot to update it cause I tried something new before making the topic. I did have a switch statement.
Quote:
Originally Posted by Djole1337
That stock above makes no sense.
pawn Код:
stock arank(playerid) { new iStr[12] ; switch (adminVariable[playerid]) { case 1: iStr = "something"; case 2: iStr = "something"; case 3: iStr = "something"; case 4: iStr = "something"; case 5: iStr = "something"; } return iStr; }
|
For one thing, the specified string size is too small, 12?, i'll just get the "destination array is too small" error.
Quote:
Originally Posted by Elie1996
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? ":)
|
You would still have to ask me what form of stats saving do I use, which is y_ini (sorry if I sound like a asshole :I, i still thank you for your help)
I dont really need help with the setlevel command, just the stock, enum, or something to give each admin level a name.