URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Xtreme Generations.
  HTML https://xgtdms.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Tutorials
       *****************************************************
       #Post#: 16--------------------------------------------------
       How to create muteme command.
   DIR By: Xtreme
       Date: July 22, 2012, 10:17 am
       ---------------------------------------------------------
       How to create muteme command.
       Introduction
       This tutorial will help you to create a mute command.
       After a player using this command,he will be muted till he
       quits.
       Difficulty: Easy
       Requirements:ZCMD include.
       I've used ZCMD to make it more easier.
       First you must include a_samp and zcmd at top of your script.
       [CODE]
       #include <a_samp>
       #include <zcmd>
       [/CODE]
       Now we need a color to give message to player.
       So lets define a color.
       Here I'll define red's hex code.
       [CODE]
       #define red 0xFF0000
       [/CODE]
       Next step is to make new function to change the stats
       of player.
       [CODE]
       new pMuted[MAX_PLAYERS];
       [/CODE]
       Now lets start with making command.
       [CODE]
       CMD:muteme(playerid,params &#91;])
       {
       #pragma unused params
       pMuted[playerid]=1; //player's stats gets changed here.
       SendClientMessage(playerid,red,''You're muted and cannot
       talk anymore.'');//Gives a message to player when he/she uses
       the cmd.
       return 1;
       }[/CODE]
       Now we are done with making mute command,but we need to make the
       player muted.
       So we must call the function on player chat.
       [CODE]
       public OnPlayerText(playerid,text)
       {
       if(pMuted[playerid] == 1)//now the mute function is
       activated.
       return SendClientMessage(playerid,red,''Error:You're muted
       so you cant talk.'');//Gives error message.
       return 0;
       }
       return 1;
       }[/CODE]
       Now we must keep a disabling mute function when player
       disconnects.
       [CODE]
       public OnPlayerDisconnect(playerid,reason)
       {
       pMuted[playerid] = 0;
       return 1;
       }[/CODE]
       We're now done with creating a mute command.
       #Post#: 17--------------------------------------------------
       Re: How to create muteme command.
   DIR By: Xtreme
       Date: July 22, 2012, 10:38 am
       ---------------------------------------------------------
       The script will look finally like this:
       [CODE]
       #include <a_samp>
       #include <zcmd>
       #define red 0xFF0000
       new pMuted[MAX_PLAYERS];
       CMD:muteme(playerid,params &#91;])
       {
       #pragma unused params
       pMuted[playerid] = 1;
       SendClientMessage(playerid,red,"You're muted and cannot
       talk.");
       return 1;
       }
       public OnPlayerText(playerid,text)
       {
       if(pMuted[playerid] == 1)
       {
       SendClientMessage(playerid,red,"Error:You're muted so you
       cannot talk");
       return 0;
       }
       return 1;
       }
       public OnPlayerDisconnect(playerid, reason)
       {
       pMuted[playerid] = 0;
       return 1;
       }
       [/CODE]
       #Post#: 18--------------------------------------------------
       Re: How to create muteme command.
   DIR By: Y_Less
       Date: July 22, 2012, 10:50 am
       ---------------------------------------------------------
       --- Code ---
       #include <a_samp>
       #include <zcmd>
       #define red 0xFF0000
       new pMuted[MAX_PLAYERS];
       
       CMD:muteme(playerid,params &#91;])
       {
       #pragma unused params
       pMuted[playerid] = 1;
       SendClientMessage(playerid,red,"You're muted and cannot
       talk.");
       return 1;
       }
       
       
       public OnPlayerText(playerid, text&#91;])
       {
       if(pMuted[playerid] == 1)
       {
       SendClientMessage(playerid,red,"Error:You're muted so you
       cannot talk");
       return 0;
       }
       return 1;
       }
       
       public OnPlayerDisconnect(playerid, reason)
       {
       pMuted[playerid] = 0;
       return 1;
       }
       --- End Code ---
       This is how the code should actually look like.
       #Post#: 19--------------------------------------------------
       Re: How to create muteme command.
   DIR By: Lord
       Date: July 22, 2012, 10:54 am
       ---------------------------------------------------------
       Nice work Xtreme.
       It's not just a tutorial a filterscript too.
       Keep going..
       #Post#: 27--------------------------------------------------
       Re: How to create muteme command.
   DIR By: Xtreme
       Date: July 23, 2012, 9:38 am
       ---------------------------------------------------------
       Thank you Lordz.
       And thanks to Y_Less for correcting my mistake.
       *****************************************************
       Page 1 of 1