29.07.2012, 07:43
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.
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.
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.
Now we must keep a disabling mute function when player disconnects.
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:
Hope you guys will like it.
Credits
Tutorial:Kalroz.
ZCMD:ZeeX.
A_SAMP:SA-MP Team.
Regards,
Kalroz.
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>
So lets define a color.
Here I'll define red's hex code.
pawn Код:
#define red 0xFF0000
of player.
pawn Код:
new pMuted[MAX_PLAYERS];
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;
}
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;
}
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
pMuted[playerid] = 0;//Player gets unmuted here.
return 1;
}
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;
}
Credits
Tutorial:Kalroz.
ZCMD:ZeeX.
A_SAMP:SA-MP Team.
Regards,
Kalroz.