Mute Problem
#1

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.
Reply
#2

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
Reply
#3

You forgot to do

pawn Код:
pInfo[playerid][Mute] = 1;
Put it in your CMD
Reply
#4

I tryed what you said saint. and I get this:

http://www.ultimategamers.info/images/Nope.jpg
Reply
#5

PHP код:

dcmd_unmute
(playerid,params[]) {
    if(
PInfo[playerid][LoggedIn] == 1) {
        if(
PInfo[playerid][Level] < 3) {
            if(!
strlen(params)) return SendClientMessage(playeridred"USAGE: /unmute [playerid]");
            new 
player1playername[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(player1playernamesizeof(playername));     GetPlayerName(playeridadminnamesizeof(adminname));
                    
CMDMessageToAdmins(playerid,"UNMUTE");
                    
PlayerPlaySound(player1,1057,0.0,0.0,0.0);  P[player1][Muted] = 0P
                    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(playeridred"Player is not muted");
            } else return 
SendClientMessage(playeridred"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
Reply
#6

Didnt work
Reply
#7

You forgot to make the player be muted.

Put this in your command.
pawn Код:
pInfo[playerid][Mute] = 1;
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)