Mute command. -
HK - 10.02.2014
Код HTML:
CMD:mute(playerid,params[])
{
if(PInfo[playerid][Level] >= 1) {
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
GetPlayerName(playerid,name, sizeof(name));
GetPlayerName(id,name2, sizeof(name2));
format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
SendClientMessageToAll(COLOR_RED,string);
PInfo[playerid][pMuted] = 1;
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
}
return 1;
}
Ok, so that code works /GREAT/, but at my onplayertext it lets my player use the chat even his muted?
Код HTML:
if(PInfo[playerid][pMuted] == 1) // your variable for logged players if(PInfo[playerid][Logged] == 1)
{
SendClientMessage(playerid,0x3FA63CFF," You are muted, not able to speak ICly.");
return 0;
}
Re: Mute command. -
HK - 10.02.2014
Please, someone?
Re: Mute command. -
DarkLored - 10.02.2014
try this
pawn Код:
CMD:mute(playerid,params[])
{
new id;
if(PInfo[playerid][Level] >= 1) {
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
GetPlayerName(playerid,name, sizeof(name));
GetPlayerName(id,name2, sizeof(name2));
format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
SendClientMessageToAll(COLOR_RED,string);
PInfo[id][pMuted] = 1;
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
}
return 1;
}
Re: Mute command. -
HK - 10.02.2014
I put it a onplayertext.
Re: Mute command. -
DarkLored - 10.02.2014
Look at my post i have edited it
Re: Mute command. -
HK - 10.02.2014
Yes dude, but the CMD:mute is working fine already, the problem is on OnPlayerText ....
Re: Mute command. -
DarkLored - 10.02.2014
What i have changed in your mute command is that you mute yourself if you type someones id try the code i gave you and check if it works
Re: Mute command. -
HK - 10.02.2014
Nope, it shows up the message that im muted but i can type..
Re: Mute command. -
DarkLored - 10.02.2014
put this under your includes
replace this with your command
pawn Код:
CMD:mute(playerid,params[])
{
if(PInfo[playerid][Level] >= 1) {
new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
GetPlayerName(playerid,name, sizeof(name));
GetPlayerName(id,name2, sizeof(name2));
format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
SendClientMessageToAll(COLOR_RED,string);
Muted[id] = 1;
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
}
return 1;
}
replace this with the onplayertext that you did
pawn Код:
if(Muted[playerid] == 1)
{
SendClientMessage(playerid,0x3FA63CFF," You are muted, not able to speak ICly.");
return 0;
}
Re: Mute command. -
HK - 10.02.2014
I'm still able to write... note that i've an proxdetector at my onplayertext....