20.10.2016, 17:33
Hey guys, I am trying to make a troll command for admins, this is my code so far:
Chatting works fine, but I couldn't write commands, it simply writes down the command in the chat
I am using ZCMD
Maybe I should call the command with the callback OnPlayerCommandReceived if the first char is "/" ?
PHP код:
CMD:fakechat(playerid, params[])
{
if(!IsAllowed(playerid, 5)) return NoAuth(playerid);
new playerb, string[128];
if(sscanf(params, "us[128]", playerb, string)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fakechat [playerid] [text]");
if(!IsPlayerConnected(playerb) || playerid == playerb) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID.");
if(IsImmune(playerid, playerb)) return NotImmune(playerid);
SendPlayerMessageToAll(playerb, string);
format(string, sizeof(string), "%s sent a fake message from %s: %s", RPN(playerid), RPN(playerb), string);
Log("logs/fakechat.log", string);
return 1;
}
I am using ZCMD
Maybe I should call the command with the callback OnPlayerCommandReceived if the first char is "/" ?