Advertisement
Guest User

Untitled

a guest
Mar 7th, 2012
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.66 KB | None | 0 0
  1. CMD:mycolor(playerid, params[])
  2. {
  3.     enum eCol
  4.     {
  5.         name[12],
  6.         col
  7.     };
  8.    
  9.     static const _colors[][eCol] = {
  10.             {"red",     0xFF0000AA},
  11.         {"green",   0x00FF00AA},
  12.         {"blue",    0x0000FFAA},
  13.         {"yellow",      0xFFFF00AA}
  14.     };
  15.    
  16.     for(new i; i < sizeof(_colors); i++)
  17.     {
  18.         if(strfind(params, _colors[i][name], true) != -1)
  19.         {
  20.             SetPlayerColor(playerid, _colors[i][col]);
  21.             return 1;
  22.         }
  23.     }
  24.    
  25.     // -----
  26.     // Color not found in list, check if hex
  27.    
  28.     new hex;
  29.    
  30.     if(sscanf(params, "x", hex))
  31.         return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /mycolor [color name or hexadecimal code]");
  32.        
  33.     SetPlayerColor(playerid, hex);
  34.     return 1;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement