Advertisement
Guest User

Dispbottom (modification - optional parameter)

a guest
Jun 6th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.60 KB | None | 0 0
  1. @@ -13561,14 +13561,39 @@ BUILDIN(atcommand) {
  2.  
  3.  /*==========================================
  4.   * Displays a message for the player only (like system messages like "you got an apple" )
  5. +   (dispbottom default ou colorido) - [SlexFire]
  6.   *------------------------------------------*/
  7.  BUILDIN(dispbottom)
  8.  {
  9.     TBL_PC *sd=script->rid2sd(st);
  10.     const char *message;
  11. +   int color = 0;
  12.     message=script_getstr(st,2);
  13. -   if(sd)
  14. -       clif_disp_onlyself(sd,message,(int)strlen(message));
  15. +  
  16. +   if (script_hasdata(st,3))
  17. +       color = script_getnum(st,3);
  18. +  
  19. +   if(sd) {
  20. +      
  21. +       if(script_hasdata(st,3)){
  22. +       const char *message = script_getstr(st,2);
  23. +       unsigned short msg_len = strlen( message ) +1;
  24. +       int color = script_getnum(st,3);
  25. +       int colorcode = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16;
  26. +       WFIFOHEAD( sd->fd, msg_len + 12 );
  27. +       WFIFOW( sd->fd, 0 ) = 0x2C1;
  28. +       WFIFOW( sd->fd, 2 ) = msg_len + 12;
  29. +       WFIFOL( sd->fd, 4 ) = 0;
  30. +       WFIFOL( sd->fd, 8 ) = colorcode;
  31. +       safestrncpy( (char*)WFIFOP( sd->fd,12 ), message, msg_len );
  32. +       WFIFOSET( sd->fd, msg_len + 12 );
  33. +       }
  34. +      
  35. +       else {
  36. +           clif_disp_onlyself(sd,message,(int)strlen(message));
  37. +       }
  38. +   }
  39. +  
  40.     return true;
  41.  }
  42.  
  43. @@ -20047,7 +20072,7 @@ void script_parse_builtin(void) {
  44.         BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
  45.         BUILDIN_DEF(pcre_match,"ss"),
  46.  #endif
  47. -       BUILDIN_DEF(dispbottom,"s"), //added from jA [Lupus]
  48. +       BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus] - Modifica??o [SlexFire]
  49.         BUILDIN_DEF(getusersname,""),
  50.         BUILDIN_DEF(recovery,""),
  51.         BUILDIN_DEF(getpetinfo,"i"),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement