16.08.2010, 16:08
- I re posted on this section becuse i posted the another one in the wrong section :S -
Hey, Im doing a chat commands and it worked when i made my commands:
when im doing another chat command "Example /helpme" i get some wierd errors
and btw, how can i know what colors:
have?
Hey, Im doing a chat commands and it worked when i made my commands:
Код:
#include <a_samp> #include "../include/chat.inc" #define MESSAGE_COLOR 0xEEEEEEFF #define ECHO_COLOR 0xEEEEEEFF #define ACTION_COLOR 0xEE66EEFF //------------------------------------------------ public OnFilterScriptInit() { print("\n--New Chat Commands from scratch -By JonnyBoy-.\n"); return 1; } //------------------------------------------------ public OnPlayerText(playerid, text[]) { if(strlen(text) > 128) return 0; new to_others[MAX_CHATBUBBLE_LENGTH+1]; new to_me[MAX_CHATBUBBLE_LENGTH+1]; format(to_others,MAX_CHATBUBBLE_LENGTH,"Says: %s",text); format(to_me,MAX_CHATBUBBLE_LENGTH,">> %s",text); SetPlayerChatBubble(playerid,to_others,MESSAGE_COLOR,35.0,10000); SendClientMessage(playerid,ECHO_COLOR,to_me); return 0; // can't do normal chat with this loaded } //------------------------------------------------ public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new Message[256]; new idx; new actiontext[MAX_CHATBUBBLE_LENGTH+1]; 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,20.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/sa", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Server Admin] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,10.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/ad", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Admin] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,5.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/n", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Newbie] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,3.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/h", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Helper] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,3.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/race", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Race] Race at %s and win 2000$! /ra for [Race] Chat!",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,2.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/ra", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[Race] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,2.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } if(strcmp("/s", cmd, true) == 0) { Message = strrest(cmdtext,idx); format(actiontext,MAX_CHATBUBBLE_LENGTH,"[STOP] %s",Message); SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,4.0,10000); SendClientMessage(playerid,ACTION_COLOR,actiontext); return 1; } return 0; // not handled by this script } //------------------------------------------------
and btw, how can i know what colors:
Код:
ACTION_COLOR,4.0,10000);