How to create muteme command. -
Kalroz - 29.07.2012
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.
Next step is to make new function to change the stats
of player.
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.
Re: How to create muteme command. -
Kindred - 29.07.2012
Yay! Another tutorial that doesn't explain anything! Woohoo!
Re: How to create muteme command. -
Kalroz - 29.07.2012
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.
Re: How to create muteme command. -
Vince - 29.07.2012
And the usefulness of this is, what?
Re: How to create muteme command. -
[MM]RoXoR[FS] - 31.07.2012
Why the fuck will anyone mute himself?
Re: How to create muteme command. -
doreto - 31.07.2012
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
Re: How to create muteme command. -
Lordzy - 31.07.2012
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.
Re: How to create muteme command. -
oKzrh - 02.08.2012
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
Re: How to create muteme command. -
AaronKillz - 02.08.2012
Why would someone want to mute themselves lol?
Re: How to create muteme command. -
Kalroz - 09.08.2012
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.
Re: How to create muteme command. -
xSkullx - 12.08.2012
You can add /unmuteme...or player will be muted =))
Gj, nice tutorial
Re: How to create muteme command. -
Lordzy - 18.08.2012
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
Re: How to create muteme command. -
Kaperstone - 18.08.2012
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.
Re: How to create muteme command. -
FalconX - 18.08.2012
Awesome I'll be using this in my whole server from today!