[Tutorial] How to create muteme command.
#1

How to create muteme command.

Introduction
This tutorial will help you to create a muteme command.
After a player using this command,the player will be muted till he/she 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.

pawn Код:
#include <a_samp>
#include <zcmd>
Now we need a color to give message to player.
So lets define a color.
Here I'll define red's hex code.
pawn Код:
#define red 0xFF0000
Next step is to make new function to change the stats
of player.

pawn Код:
new pMuted[MAX_PLAYERS];
Now lets start with making command.

pawn Код:
CMD:muteme(playerid,params [])
{
#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;
 }
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.

pawn Код:
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;
}
Now we must keep a disabling mute function when player disconnects.
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
     pMuted[playerid] = 0;//Player gets unmuted here.
     return 1;
}
We're now done with creating a mute command.

Problems/Errors
If you find any problems or errors,please tell me.
I didnt check this script coz im posting this via Mobile.

This is how the script look:
pawn Код:
#include <a_samp>
#include <zcmd>
#define red 0xFF0000
new pMuted[MAX_PLAYERS];

CMD:muteme(playerid,params [])
{
#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;
}
Hope you guys will like it.

Credits
Tutorial:Kalroz.
ZCMD:ZeeX.
A_SAMP:SA-MP Team.


Regards,
Kalroz.
Reply
#2

Yay! Another tutorial that doesn't explain anything! Woohoo!
Reply
#3

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Yay! Another tutorial that doesn't explain anything! Woohoo!
I've posted,I posted this tutorial through mobile so there will be some problems.
Reply
#4

And the usefulness of this is, what?
Reply
#5

Why the fuck will anyone mute himself?
Reply
#6

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Why the fuck will anyone mute himself?
Good question can someone anser it !!!


SendClientMessage(playerid,red,''Error:You're muted so you cant talk.'');


Why you have put ' ' instet of " bether fix it right now becose it wrong and will make problem " if " someone use it
Reply
#7

Quote:
Originally Posted by doreto
Посмотреть сообщение
Good question can someone anser it !!!


SendClientMessage(playerid,red,''Error:You're muted so you cant talk.'');


Why you have put ' ' instet of " bether fix it right now becose it wrong and will make problem " if " someone use it
I think this guy is showing some functions to create such cmds like mute[playerid].
But this tutorial would have been useful if you made it as /freezeme,/unfreezeme because in some servers,users becomes uncontrollable and admins need to freeze and unfreeze them to get back controllable.

Any way this is your first try,not bad but develop next time.
Reply
#8

Give it a break guys, he's new.
Good work man, some improvements needed, but still...
  • When you're trying to write a tutorial, don't just give the codes. Explain them.
  • Try to make useful and creative tutorial, not something that 100% no one will use.
Keep up
Reply
#9

Why would someone want to mute themselves lol?
Reply
#10

Quote:
Originally Posted by oKzrh
Посмотреть сообщение
Give it a break guys, he's new.
Good work man, some improvements needed, but still...
  • When you're trying to write a tutorial, don't just give the codes. Explain them.
  • Try to make useful and creative tutorial, not something that 100% no one will use.
Keep up
You're right im new.
And thanks also I'll try to explain+make creative tutorial.
Reply
#11

You can add /unmuteme...or player will be muted =))
Gj, nice tutorial
Reply
#12

I agree with xSkullx.

Kalroz,add this:

pawn Code:
CMD:unmuteme(playerid,params[])
{
        if(pMuted[playerid] == 0;
        {
        SendClientMessage(playerid,0xFF0000,"You must be Muted to use this command.");
        }
       else
       {        
        pMuted[playerid] = 0;
        SendClientMessage(playerid,0xFF0000,"You've unmuted yourself");
        return 1;
}
Im through mobile and also Im not scripting for 5 months,so I couldnt check+donno whether right or wrong
Reply
#13

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Why the fuck will anyone mute himself?

OT: nice tutorial,would be better if you would explane how to mute others too =3.
Reply
#14

Awesome I'll be using this in my whole server from today!


Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)