Guest User

Untitled

a guest
Oct 16th, 2011
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_PLAY 32 // Slots on your server
  4.  
  5. #define interval 100
  6.  
  7. new Text:ANIMHORSE[MAX_PLAY];
  8. new curHorseStage[MAX_PLAY] = {1, ...};
  9. new HORSE_TIMER[MAX_PLAY];
  10.  
  11. #define dcmd(%1,%2,%3) if((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  12.  
  13. public OnPlayerCommandText(playerid, cmdtext[])
  14. {
  15. dcmd(horse, 5, cmdtext);
  16. return 0;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21. for(new playerid=0; playerid<MAX_PLAY; playerid++)
  22. {
  23. if(GetPVarInt(playerid, "ANIM_HORSE")) TextDrawDestroy(ANIMHORSE[playerid]);
  24. }
  25. }
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29. if(GetPVarInt(playerid, "ANIM_HORSE"))
  30. {
  31. KillTimer(HORSE_TIMER[playerid]);
  32. TextDrawDestroy(ANIMHORSE[playerid]);
  33. }
  34. return 1;
  35. }
  36.  
  37. dcmd_horse(playerid, params[])
  38. {
  39. #pragma unused params
  40. if(GetPVarInt(playerid, "ANIM_HORSE"))
  41. {
  42. SetPVarInt(playerid, "ANIM_HORSE", 0);
  43. KillTimer(HORSE_TIMER[playerid]);
  44. TextDrawDestroy(ANIMHORSE[playerid]);
  45. return 1;
  46. }
  47.  
  48. SetPVarInt(playerid, "ANIM_HORSE", 1);
  49.  
  50. ANIMHORSE[playerid] = TextDrawCreate(448.000000, 327.000000, "LD_OTB:hrs1");
  51. TextDrawAlignment(ANIMHORSE[playerid], 2);
  52. TextDrawBackgroundColor(ANIMHORSE[playerid], 255);
  53. TextDrawFont(ANIMHORSE[playerid], 4);
  54. TextDrawLetterSize(ANIMHORSE[playerid], 0.500000, 1.000000);
  55. TextDrawColor(ANIMHORSE[playerid], -1);
  56. TextDrawSetOutline(ANIMHORSE[playerid], 0);
  57. TextDrawSetProportional(ANIMHORSE[playerid], 1);
  58. TextDrawSetShadow(ANIMHORSE[playerid], 1);
  59. TextDrawUseBox(ANIMHORSE[playerid], 1);
  60. TextDrawBoxColor(ANIMHORSE[playerid], 255);
  61. TextDrawTextSize(ANIMHORSE[playerid], 200.000000, 200.000000);
  62.  
  63. TextDrawShowForPlayer(playerid, ANIMHORSE[playerid]);
  64.  
  65. curHorseStage[playerid] = 2;
  66.  
  67. HORSE_TIMER[playerid] = SetTimerEx("do_horse_anim", interval, 1, "i", playerid);
  68.  
  69. SendClientMessage(playerid, 0xFFFFFFFF, "Type {FFFF82}/horse{FFFFFF} again to turn off horse.");
  70. return 1;
  71. }
  72.  
  73. forward do_horse_anim(playerid);
  74. public do_horse_anim(playerid)
  75. {
  76. if(!IsPlayerConnected(playerid) || !GetPVarInt(playerid, "ANIM_HORSE"))
  77. {
  78. KillTimer(HORSE_TIMER[playerid]);
  79. TextDrawDestroy(ANIMHORSE[playerid]);
  80. return 1;
  81. }
  82.  
  83. curHorseStage[playerid]++;
  84. if(curHorseStage[playerid] == 9) curHorseStage[playerid] = 1;
  85. new string[12];
  86. format(string, sizeof(string), "LD_OTB:hrs%i", curHorseStage[playerid]);
  87. TextDrawSetString(ANIMHORSE[playerid], string);
  88.  
  89. TextDrawHideForPlayer(playerid, ANIMHORSE[playerid]);
  90. TextDrawShowForPlayer(playerid, ANIMHORSE[playerid]);
  91. return 1;
  92. }
  93.  
Advertisement
Add Comment
Please, Sign In to add comment