SA-MP Forums Archive
pls help, the other func is not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: pls help, the other func is not working (/showthread.php?tid=267590)



pls help, the other func is not working - handerson - 09.07.2011

Код:
public OnPlayerText(playerid, text[])
{
    //Mute Player//
    if(Mute[playerid] == 1)
    {
        return 0;
    }
     if(Mute[playerid] == 0)
    {
     return 1;
    }
    new pName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pName, sizeof(pName));

  	if(text[0] == '!')
    {
    format(string, sizeof(string), "[TeamChat] "COL_WHITE"%s: "COL_GREEN"(%i) %s", pName, playerid, text[1]);
    printf("%s", string);
    for(new i=0,b=GetMaxPlayers();i<b;i++)
    {
            if(gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
        }
    return 0;
	}
    format(string, sizeof(string), "(%i) %s",playerid, text);
    SendPlayerMessageToAll(playerid, string);
    return 0;
}
mute is work
but Team chat is not working

what should i do, pls help


Re: pls help, the other func is not working - Bakr - 09.07.2011

That is because you're stopping the code whether or not their muted.
pawn Код:
if(Mute[playerid] == 0)
    {
     return 1;
    }
This code checks if the player is not muted, and lets them send the default message. Remove this section of the code and the rest of the callbacks code will be executed.


Re: pls help, the other func is not working - handerson - 09.07.2011

so, how i unmuted player




Re: pls help, the other func is not working - Bakr - 09.07.2011

How do you unmute a player? You set the player-variable 'Mute' to zero.


Re: pls help, the other func is not working - handerson - 09.07.2011

im newb,,, i just searched that func in this forum, how to fix??


Re: pls help, the other func is not working - Bakr - 09.07.2011

I cannot understand what you're asking. If you want to enable team chat to work correctly, then remove the code I provided to you in my first response from the OnPlayerText callback. If you want to un-mute the player after they have been muted, you will need to set their variable to zero, like below:
pawn Код:
Mute[ playerid ] = 0;