13.09.2009, 14:17
For one thing, you should make the global chat variable a boolean operator since it's only gonna be set to 0 or 1. There's no need to have an array of 200 if it's for something global like that. This should work. I normally don't use strtok and I didn't compile this so...
pawn Код:
new bool:globalchat;
if(!strcmp(cmd, "/enablegc", true))
{
if (AccountInfo[playerid][AdminLevel] > 1 || IsPlayerAdmin(playerid))
{
globalchat = true;
}
else return SendClientMessage(playerid, RED, "Youґre not the needed admin level.");
}
if(!strcmp(cmd, "/disablegc", true))
{
if (AccountInfo[playerid][AdminLevel] > 1 || IsPlayerAdmin(playerid))
{
globalchat = false;
}
else return SendClientMessage(playerid, RED, "Youґre not the needed admin level.");
}
if(!strcmp(cmd, "/g", true))
{
if(!globalchat)
{
SendClientMessage(playerid,RED,"Global chat is not currently enabled.");
return 1;
}
new tmp[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,RED,"Usage: /g [text]");
return 1;
}
new string[128],name[24];
GetPlayerName(playerid,name,24);
format(string,128,"[Global Chat]-%s: %s",name,tmp);
SendClientMessageToAll(COLOR,string);
return 1;
}

