Код:
#include <a_samp>
#include <core>
#include <float>
#include "../include/Common.inc"
#define MESSAGE_COLOR 0xEEEEEEFF
#define ECHO_COLOR 0xEEEEEEFF
#define ACTION_COLOR 0xEE66EEFF
//------------------------------------------------
public OnFilterScriptInit()
{
print("\n--Chat Commands Loaded\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new Message[256];
new AdMessage[256];
new Dice;
new idx;
new actiontext[MAX_CHATBUBBLE_LENGTH+1];
new talktext[MAX_CHATBUBBLE_LENGTH+1];
new gambletext[MAX_CHATBUBBLE_LENGTH+1];
new adtext[256];
cmd = strtok(cmdtext, idx);
// Action command
if(strcmp("/me", cmd, true) == 0)
{
Message = strrest(cmdtext,idx);
format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s *",Message);
SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,30.0,10000);
SendClientMessage(playerid,ACTION_COLOR,actiontext);
return 1;
}
// Talk commmand
if(strcmp("/l", cmd, true) == 0)
{
Message = strrest(cmdtext,idx);
new Playername[24];
GetPlayerName(playerid, Playername, 24);
format(talktext,MAX_CHATBUBBLE_LENGTH,"%s says: %s",Playername, Message);
SetPlayerChatBubble(playerid,talktext,MESSAGE_COLOR,30.0,10000);
SendClientMessage(playerid,MESSAGE_COLOR,talktext);
return 1;
}
// Dice commmand
if(strcmp("/dice", cmd, true) == 0)
{
new Playername[24];
GetPlayerName(playerid, Playername, 24);
Dice = random(6);
format(gambletext,MAX_CHATBUBBLE_LENGTH,"%s rolled %s",Playername, Dice);
SetPlayerChatBubble(playerid,talktext,MESSAGE_COLOR,30.0,10000);
SendClientMessage(playerid,MESSAGE_COLOR,gambletext);
return 1;
}
// Advertise commmand
if(strcmp("/ad", cmd, true) == 0)
{
AdMessage = strrest(cmdtext,idx);
new Playername[24];
GetPlayerName(playerid, Playername, 24);
format(adtext,256,"[Advertise]%s , contact %s",AdMessage, Playername);
SendClientMessageToAll(MESSAGE_COLOR,adtext);
GivePlayerMoney(playerid, -5);
return 1;
}
return 0; //Not handled by this script
}
is my code for some chat thingies but /ad and /dice doesnt work!!! /l and /me does and I get no errors. When I write /ad "afagaf" or /dice says SERVER: Unknown command.