09.11.2010, 13:31
(
Последний раз редактировалось Zh3r0; 09.11.2010 в 15:06.
)
+1.
This is your /mute command, which is idented as fuck.
This is my command.
And true, this is a fail.
Also i hate it when people use SSCANF with DCMD ...When ZCMD is clearly faster
This is your /mute command, which is idented as fuck.
pawn Код:
dcmd_mute(playerid,params[])
{
new
Reason[256],
pID,
i;
if(Player[playerid][admin] < 1){
return SendClientMessage(playerid,COLOR_RED,"You Dont Have Right To Use This Command!");
}
if(sscanf(params,"us",pID,Reason)){
return SendClientMessage(playerid,COLOR_RED,"|| 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`t MUTE Yourself");
}
if(Player[pID][admin] < Player[pID][admin]){
return SendClientMessage(playerid,COLOR_RED,"You Can`t MUTE A High Ranked Admin");
}
new
name[MAX_PLAYER_NAME],
string[256], string2[256], string3[256], string4[256];
GetPlayerName(pID,name,sizeof(name));
format(string,sizeof(string),"**(ADMIN MUTE)** %s(%d) %s READ /Rules",name,pID,Reason);
format(string2,sizeof(string2),"%s(%d)(Has Been Forced To Read Rules)",name,pID);
format(string3,sizeof(string3),"You Have Been MUTED By Admin For Reason: %s",Reason);
format(string4, sizeof(string4), "You Have MUTED %s(%d) For: %s",name, pID, Reason);
SendClientMessageToAll(COLOR_RED,string);
SendClientMessageToAll(COLOR_RED,string2);
SendClientMessage(pID, COLOR_RED, string3);
SendClientMessage(i, COLOR_RED, string4);
SaveToFile("MuteWarnings",string); Muted[pID] = 1;
return 1;
}
This is my command.
pawn Код:
CMD:mute(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 2)return SendError( playerid, "You are not allowed to use this command"),SendClientMessage(playerid, COLOR_WHITE, "REASON: Low level!");
if (P_DATA[ playerid ][ P_LoggedIN ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "us", params[ 0 ], params[ 1 ]) )return SendUsage( playerid, "/mute <id> [reason]" );
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
if (P_DATA[ playerid ][ P_Muted ] == 1)return SendError( playerid, "Player is already muted");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
if( params[ 0 ] == playerid )return SendError( playerid, "You can't mute yourself!");
FormMessageForAllEx(playerid,COLOR_GREEN, "Administrator %s muted %s! [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ), params[ 1 ]);
FormMessage( params[ 0 ], COLOR_GREEN, "Administrator %s muted you! [Reason: %s ]",PlayerName2( playerid ), params[ 1 ]);
FormMessage( playerid, COLOR_GREEN, "You have muted %s [Reason: %s]",PlayerName2( params[ 0 ] ), params[ 1 ]);
P_DATA[ params[ 0 ] ][ P_Muted ] = 1;
return 1;
}
Also i hate it when people use SSCANF with DCMD ...When ZCMD is clearly faster