RaFaeLs

RaFaeL - Movable 3D text

Oct 4th, 2012
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.83 KB | None | 0 0
  1. #if defined _r3mt_included
  2.     #endinput
  3. #endif
  4. #define _r3mt_included
  5.  
  6. #define MAX_MOVINGTEXT 100
  7.  
  8. new Text3D:mtexts[MAX_MOVINGTEXT], rmtid, rmtcolor[sizeof(mtexts)], rmstring1[256][sizeof(mtexts)], texton3dtext[256][sizeof(mtexts)], rmtimer[sizeof(mtexts)];
  9.  
  10. /*
  11. native CreateMoveable3DText(string[], speed, color, Float:distance, Float:x, Float:y, Float:z, virtualworld = -1, testLOS = 0);
  12. native DeleteMoveable3DTextLabel(textid);
  13. native AttachMoveable3DTextToVehicle(textid, vehid, Float:offsetx = 0.0, Float:offsety = 0.0, Float:offsetz = 0.0);
  14. native AttachMoveable3DTextToPlayer(textid, playerid, Float:offsetx = 0.0, Float:offsety = 0.0, Float:offsetz = 0.0);
  15. native UpdateMoveable3DTextLabelText(textid, string[], color, speed = 1);
  16. */
  17.  
  18. stock CreateMoveable3DText(string[], speed, color, Float:distance, Float:x, Float:y, Float:z, virtualworld = -1, testLOS = 0)
  19. {
  20.     if(rmtid < sizeof(mtexts))
  21.     {
  22.         rmtid++;
  23.         rmtcolor[rmtid] = color;
  24.         format(texton3dtext[rmtid], sizeof(texton3dtext), "%s ", string);
  25.         mtexts[rmtid] = Create3DTextLabel(texton3dtext[rmtid], rmtcolor[rmtid], x,y,z, distance, virtualworld, testLOS);
  26.         rmtimer[rmtid] = SetTimerEx("Move3DText", speed*100, true, "i",rmtid);
  27.        
  28.         return rmtid;
  29.     } else {
  30.         return printf("[RaFaeL] (Warning) Maximum of moving text is: %d", MAX_MOVINGTEXT);
  31.     }
  32. }
  33. stock DeleteMoveable3DTextLabel(textid)
  34. {
  35.     if(textid > rmtid) return printf("[RaFaeL] (Error) Invalid textid: %d", textid);
  36.     format(texton3dtext[textid], sizeof(texton3dtext), " ");
  37.     KillTimer(rmtimer[textid]);
  38.     Delete3DTextLabel(mtexts[textid]);
  39.     return true;
  40. }
  41.  
  42. stock AttachMoveable3DTextToVehicle(textid, vehid, Float:offsetx = 0.0, Float:offsety = 0.0, Float:offsetz = 0.0)
  43. {
  44.     if(textid > rmtid) return printf("[RaFaeL] (Error) Invalid textid: %d", textid);
  45.     Attach3DTextLabelToVehicle(mtexts[textid], vehid, offsetx, offsety, offsetz);
  46.     return true;
  47. }
  48. stock AttachMoveable3DTextToPlayer(textid, playerid, Float:offsetx = 0.0, Float:offsety = 0.0, Float:offsetz = 0.0)
  49. {
  50.     if(textid > rmtid) return printf("[RaFaeL] (Error) Invalid textid: %d", textid);
  51.     Attach3DTextLabelToPlayer(mtexts[textid], playerid, offsetx, offsety, offsetz);
  52.     return true;
  53. }
  54.  
  55. stock UpdateMoveable3DTextLabelText(textid, string[], color, speed = 1)
  56. {
  57.     if(textid > rmtid) return printf("[RaFaeL] (Error) Invalid textid: %d", textid);
  58.     format(texton3dtext[textid], sizeof(texton3dtext), "%s ", string);
  59.     rmtcolor[textid] = color;
  60.     KillTimer(rmtimer[textid]);
  61.     rmtimer[textid] = SetTimerEx("Move3DText", speed*100, true, "i",textid);
  62.     return true;
  63. }
  64.  
  65. forward Move3DText(txtid2);
  66. public Move3DText(txtid2)
  67. {
  68.     format(rmstring1[txtid2], 2, "%c", texton3dtext[txtid2]);
  69.     strdel(texton3dtext[txtid2], 0, 1);
  70.     strcat(texton3dtext[txtid2], rmstring1[txtid2]);
  71.     Update3DTextLabelText(mtexts[txtid2], rmtcolor[txtid2], texton3dtext[txtid2]);
  72. }
Advertisement
Add Comment
Please, Sign In to add comment