02.03.2011, 11:24
Try this
Toggle for /n [chat]
chat cmd
Not tested
pawn Код:
new bool:NewbieChat;
pawn Код:
public OnGameModeInit()
{
NewbieChat = true;
return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/togglenc", true, 9))
{
if(NewbieChat == true)
{
SendClientMessage(playerid, COLOR, "Newbie chat disabled");
NewbieChat = false;
}
else
{
SendClientMessage(playerid, COLOR, "Newbie chat enabled");
NewbieChat = true;
}
return 1;
}
pawn Код:
if(!strcmp(cmdtext,"/n",true,2))
{
if(PlayerInfo[playerid][Newbie] ==0) return SendClientMessage(playerid,0xffffffaa,"You are not a newbie"); //checking if a player is not a noob, change it to your variable if any
if(NewbieChat == false) return SendClientMessaeg(playerid, COLOR, "Newbie chat is disabled!");
new name[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,name,sizeof(name));
for(new i=0; i< MAX_PLAYERS;i++)
{
if(PlayerInfo[i][Newbie] ==1)
{
format(string,sizeof(string),"[NewbieChat] %s: %s",name,cmdtext[3]);
SendClientMessage(i,0xffffffaa,string);
}
}
return 1;
}
![Smiley](images/smilies/smile.png)