10.12.2011, 15:45
I've once created a "chat commands" system, I guess that it could be useful:
pawn Код:
// OnPlayerText
if(text[0] == '@')
{
if(!OnPlayerChatCommand(playerid,text)) SendClientMessage(playerid,0xffffffff,"SERVER: Unknown chat command.");
return 0;
}
pawn Код:
// New callback
forward OnPlayerChatCommand(playerid,cmdtext[]);
public OnPlayerChatCommand(playerid,cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext,idx);
if(equal(cmd,"@help") || equal(cmd,"@cmd"))
{
SendClientMessage(playerid,0xffffffff,"Help...");
// ...
return 1;
}
return 0;
}