How To Do That?
#1

Код:
dcmd_mute(playerid,params[])
{
	new
	    Reason[256],
	    pID;
    if(Player[playerid][admin] < 1){
	 	return SendClientMessage(playerid, COLOR_RED, "Bad Command! Type /command for right commands");
 		}
	if(sscanf(params,"us",pID,Reason)){
		return SendClientMessage(playerid,COLOR_GREY,"Usage: /mute [playerid] [reason] ");
		}
	if(!IsPlayerConnected(pID)) {
	    return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
	    }
 	if(playerid == pID){
		return SendClientMessage(playerid,COLOR_RED,"You Can Not Mute Yourself");
		}
	if(Player[playerid][admin] < Player[pID][admin]){
		return SendClientMessage(playerid,COLOR_RED,"You Can Not Mute A High Ranked Admin");
		}
	if(Muted[pID] == 1)
	    return SendClientMessage(playerid,COLOR_RED,"This player is already muted");

	new
 	name[24],aname[24],
 	string1[128], string2[128], string3[128], string4[128];
	GetPlayerName(pID,name,sizeof(name));
	GetPlayerName(playerid,aname,sizeof(aname));
	format(string1,sizeof(string1),"**(ADMIN MUTE)** %s(%d) %s",name,pID,Reason);
	format(string2,sizeof(string4),"Admin %s(%d) Has Mute %s(%d) For Reason: %s",aname,playerid,name,pID,Reason);
	format(string3,sizeof(string2),"You Have Been Muted By Admin For Reason: %s",Reason);
	format(string4, sizeof(string3), "You Have Mute %s(%d) For Reason: %s",name, pID, Reason);
	SendClientMessageToAll(COLOR_GOLD,string1);
	SendClientMessage(pID,0xFF7F50AA,string2);
	SendClientMessage(playerid,COLOR_GREEN,string3);
	SendAdminMessage(COLOR_YELLOW,string4);
	SaveToFile("Mutes",string4); Muted[pID] = 1;
return 1;
}



in this message is been write like this here:
Код:
format(string2,sizeof(string4),"Admin %s(%d) Has Mute %s(%d) For Reason: %s",aname,playerid,name,pID,Reason);
now the admin word i need to change it like this

Код:
format(string2,sizeof(string4),"%s %s(%d) Has Mute %s(%d) For Reason: %s",aname,playerid,name,pID,Reason);
I Change Admin To %s

now what i need how i can make the %s that i but it instead of Admin to give me rank so what i mean if player in my server is Moderator


if need the Message Say

Moderator %s(%d) Has Mute ,... To End Help! Please You Are The Key Guys.
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
The simplest way would be something like:

pawn Код:
new
    gAdminRanks[][] = {
        "Voice",
        "Moderator",
        "Admin",
        "Owner"
    };
Then:

pawn Код:
format(str, sizeof (str), "%s %s(%d) ...", gAdminRanks[playerRank], playerName, playerId);
ok now when i do gAdminRanks[playerRank], playerName,playerid);

now playerRank what its mean can you say this step i do it now if player level 1 = moderator if level 2 = admin

thats all now can you tell more please so i can know completley thanks
Reply
#3

playerRank is a variable ****** substituted for whatever variable you are using to store your administrative level in the server. All you have to do is replace playerRank with the variable you use, keep in mind that with ******'s example, you will get an out of bounds error in runtime if the variable goes above 3, since there are only 4 strings in the array.
Reply
#4

i have do my own variable gAdminRanks[Player[playerid][admin]], ...


but when i go in server and type commands its tell me


SERVER: UNKNOWN COMMAND
Reply
#5

Like I said, that's probably caused by the fact that you're getting an out of bounds error during runtime. Which means that your administrative level is greater than 4, this example that ****** posted only supports up to "level" 3. So you need to either add more ranks to the array, or decrease your administrative level.
Reply
#6

i have do like thsi


new gAdminRanks[][] = {
"Moderator",
"Administrator"
};

so i its 2 not 4 and i got 2 levels level 1 is Moderator Level 2 is administrator
Reply
#7

Quote:
Originally Posted by [Lsgw]LoL
Посмотреть сообщение
i have do like thsi


new gAdminRanks[][] = {
"Moderator",
"Administrator"
};

so i its 2 not 4 and i got 2 levels level 1 is Moderator Level 2 is administrator
So the value of Player[playerid][admin] is either 0 or 1 when you type that command? As for moderator you would need to be 0, and for administrator you would need to be 1.
Reply
#8

Oh Thanks man you realy help me hope to you good luck!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)