SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

  1. //
  2. // Example use of chat above player's head
  3. //
  4. #include <a_samp>
  5. #include "../include/gl_common.inc"
  6. #define MESSAGE_COLOR 0xEEEEEEFF
  7. #define ECHO_COLOR 0xEEEEEEFF
  8. #define ACTION_COLOR 0xEE66EEFF
  9. //------------------------------------------------
  10. public OnFilterScriptInit()
  11. {
  12. print("\n--Speech bubble example loaded.\n");
  13. return 1;
  14. }
  15. //------------------------------------------------
  16. public OnPlayerText(playerid, text[])
  17. {
  18. if(strlen(text) > 128) return 0;
  19. new to_others[MAX_CHATBUBBLE_LENGTH+1];
  20. new to_me[MAX_CHATBUBBLE_LENGTH+1];
  21. format(to_others,MAX_CHATBUBBLE_LENGTH,"Says: %s",text);
  22. format(to_me,MAX_CHATBUBBLE_LENGTH,">> %s",text);
  23. SetPlayerChatBubble(playerid,to_others,MESSAGE_COLOR,35.0,10000);
  24. SendClientMessage(playerid,ECHO_COLOR,to_me);
  25. return 0; // can't do normal chat with this loaded
  26. }
  27. //------------------------------------------------
  28. public OnPlayerCommandText(playerid, cmdtext[])
  29. {
  30. new cmd[256];
  31. new Message[256];
  32. new idx;
  33. new actiontext[MAX_CHATBUBBLE_LENGTH+1];
  34. cmd = strtok(cmdtext, idx);
  35. // Action command
  36. if(strcmp("/me", cmd, true) == 0)
  37. {
  38. Message = strrest(cmdtext,idx);
  39. format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s",Message);
  40. SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,30.0,10000);
  41. SendClientMessage(playerid,ACTION_COLOR,actiontext);
  42. return 1;
  43. }
  44. return 0; // not handled by this script
  45. }
  46. //------------------------------------------------