Advertisement
Guest User

RandCol - Random Chat Color

a guest
Feb 17th, 2016
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. forward RandColor(playerid);
  4.  
  5. new RandCol[] =
  6. {
  7. 0xFF0000FF, 0x00FF00FF, 0x0000FFFF, 0xFFFFFFFF, 0x000000FF,
  8. 0xFF00FFFF, 0xF0F8FFFF, 0xFAEBD7FF, 0x00FFFFFF, 0x7FFFD4FF,
  9. 0xF0FFFFFF, 0xA52A2AFF, 0x008B8BFF, 0xE9967AFF, 0x00BFFFFF,
  10. 0xFFD700FF, 0x808080FF, 0x008000FF, 0x800000FF, 0x000080FF
  11. };
  12.  
  13. public OnPlayerConnect(playerid)
  14. {
  15. SetTimerEx("RandColor", 3000, true, "i", playerid);
  16. return 1;
  17. }
  18.  
  19. public OnPlayerText(playerid, text[])
  20. {
  21. new chat[128], name[MAX_PLAYER_NAME];
  22. GetPlayerName(playerid, name, sizeof(name));
  23. format(chat, sizeof(chat), "{%06x}%s{FFFFFF} [%d]: %s", GetPlayerColor(playerid) >>> 8, name, playerid, text);
  24. SendClientMessageToAll(-1, chat);
  25. return 0;
  26. }
  27.  
  28. public RandColor(playerid)
  29. {
  30. new rand = random(sizeof(RandCol));
  31. SetPlayerColor(playerid, RandCol[rand]);
  32. return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement