Mute Problem -
[UG]Scripter - 07.09.2010
I have a problem with my Mute Command.
Command:
pawn Код:
dcmd_mute(playerid,params[])
{
new id,file[256],n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /mute <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"%s has Muted %s",n,on);
SendClientMessageToAll(LIGHTBLUE,str);
dini_IntSet(file,"Mute",1);
return 1;
}
OnPlayerText:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PInfo[playerid][Mute] == 1) return SendClientMessage(playerid,YELLOW,"(INFO) You have been Muted and Can't talk, Contact an Admin!");
return 1;
}
No Idea what i did wrong.
Re: Mute Problem -
[Saint] - 07.09.2010
pawn Код:
public OnPlayerText(playerid, text[])
{
if (PInfo[playerid][Mute] == 1)
{
SendClientMessage(playerid,YELLOW,"(INFO) You have been Muted and Can't talk, Contact an Admin!");
return 0;
}
return 1;
}
try
Re: Mute Problem -
iTorran - 07.09.2010
You forgot to do
pawn Код:
pInfo[playerid][Mute] = 1;
Put it in your CMD
Re: Mute Problem -
[UG]Scripter - 07.09.2010
I tryed what you said saint. and I get this:
http://www.ultimategamers.info/images/Nope.jpg
Re: Mute Problem -
James124 - 07.09.2010
PHP код:
dcmd_unmute(playerid,params[]) {
if(PInfo[playerid][LoggedIn] == 1) {
if(PInfo[playerid][Level] < 3) {
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unmute [playerid]");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (P[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
if(PInfo[player1][Muted] == 1) {
// change these to ur needs
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
CMDMessageToAdmins(playerid,"UNMUTE");
PlayerPlaySound(player1,1057,0.0,0.0,0.0); P[player1][Muted] = 0; P
format(string,sizeof(string),"You have been unmuted by Administrator %s",adminname); SendClientMessage(player1,blue,string);
format(string,sizeof(string),"You have unmuted %s", playername); return SendClientMessage(playerid,blue,string);
} else return SendClientMessage(playerid, red, "Player is not muted");
} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
try this but change it to ur needs
Re: Mute Problem -
[UG]Scripter - 07.09.2010
Didnt work
Re: Mute Problem -
miokie - 07.09.2010
You forgot to make the player be muted.
Put this in your command.
pawn Код:
pInfo[playerid][Mute] = 1;
Re: Mute Problem -
PinkFloydLover - 07.09.2010
If you got this from my tutorial then do it like this:
add onto the enum:
pawn Код:
enum gPInfo
{
Logged,
Regged,
Level,
Muted
}
then OnPlayerConnect add
pawn Код:
PInfo[playerid][Muted] = 0;
then OnPlayerText add
pawn Код:
if(PInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid,LIGHTBLUE,"You are muted!
return 0;
}
then change your command to:
pawn Код:
dcmd_mute(playerid,params[])
{
new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /mute <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"You have been muted by %s",n);
SendClientMessage(playerid,ORANGE,str);
PInfo[id][Muted] = 1;
return 1;
}
there you go