03.09.2011, 08:26
Hey, i'm working on an AFK system. It works great but now i am looking for a function that disables the player chat. If there is any how is it called? thanks!
new bool:Muted[MAX_PLAYERS];
public OnPlayerText(playerid,text[])
{
if(Muted[playerid])
{
SendClientMessage(playerid,color,"You're muted.");
//..................
new bool:Muted[MAX_PLAYERS];
public OnPlayerText(playerid,text[])
{
if(Muted[playerid])
{
SendClientMessage(playerid,color,"You're muted.");
return 0; // This will stop the the gamemode from sending your message to everyone
}
return 1;
}
new bool:Muted[MAX_PLAYERS];
stock TogglePlayerChat(playerid,bool:toggle)
{
if(0 > toggle || toggle > 1) return 1;
Muted[playerid] = toggle;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/afk", true))
{
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string, sizeof(string), "--) %s Has entered AFK mode.", pName);
SendClientMessage(playerid,COLOR_YELLOW, "You are now in AFK mode. Use /back to go back!");
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid, 0);
GetPlayerHealth(playerid, naty[playerid]);
GetPlayerPos(playerid, x,y,z);
SetPlayerPos(playerid, 2879.5769,2523.5569,10.8203);
SetPlayerHealth(playerid, 999999999999999.99);
return 1;
}
if(strcmp(cmdtext, "/back", true) == 0)
{
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string, sizeof(string), "--) %s Is now back.", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid, 1);
SetPlayerHealth(playerid, naty[playerid]);
SetPlayerPos(playerid, x,y,z);
return 1;
}
return 0;
}
new bool:Muted[MAX_PLAYERS]; // this will create a boolean, player-bounded(because of the [MAX_PLAYERS])-variable.
public OnPlayerText(playerid,text[])
{
if(Muted[playerid]) // this will check if you are muted, if you are muted it will do the things down
{
SendClientMessage(playerid,color,"You're muted."); // sends the message and says youre muted
return 0; // This will stop the the gamemode from sending your message to everyone
}
return 1; // if youre not muted, it will continue and show what you wanted to send
}