Guest User

Hitmarker - [VGS]GuaxXxiniN

a guest
May 23rd, 2014
1,582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.60 KB | None | 0 0
  1. #include <a_samp>//hurr, obviously the original samp functions
  2. #include <YSI\y_commands> //cmd: etc
  3.  
  4. #define FILTERSCRIPT//defines it as a filterscript
  5. #define DIALOG_MARKER 99//dialog ID 99 - trying to prevent conflicts.
  6. #define DIALOG_ADJUSTMENTS 100//dialog ID 100 - trying to prevent conflicts.
  7.  
  8. #define COLOR_GREEN 0x00FF00FF//defining green color
  9. #define COLOR_RED 0xFF0000FF//defining red color
  10.  
  11. new Text:HitMarker;//hitmarker textdraw
  12. new actmarker[MAX_PLAYERS];//variable to check if player wants or not the hitmarker to appear
  13. new timarker;//variable that we use later as the hitmarker timer
  14.  
  15. public OnFilterScriptInit()
  16. {
  17.     print("\n--------------------------------------");
  18.     print(" HitMarker Filterscript - [VGS]GuaxXxiniN"); // Do whatever you want with this filterscript, just don't remove the credits. Appreciate it.
  19.     print("--------------------------------------\n");
  20.    
  21.     HitMarker = TextDrawCreate(334.000000, 174.000000, "x");
  22.     TextDrawBackgroundColor(HitMarker, 255);
  23.     TextDrawFont(HitMarker, 1);
  24.     TextDrawLetterSize(HitMarker, 0.500000, 1.000000);
  25.     TextDrawColor(HitMarker, -16776961);
  26.     TextDrawSetOutline(HitMarker, 0);
  27.     TextDrawSetProportional(HitMarker, 1);
  28.     TextDrawSetShadow(HitMarker, 1);
  29.     return 1;
  30. }
  31.  
  32. forward HTD(issuerid);
  33. public HTD(issuerid)
  34. {
  35.     TextDrawHideForPlayer(issuerid, HitMarker);
  36.     KillTimer(timarker);
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  41. {
  42.     if(actmarker[issuerid] >= 1)
  43.     {
  44.         TextDrawShowForPlayer(issuerid, HitMarker);
  45.         timarker = SetTimerEx("HTD", 250, true, "%d", issuerid);
  46.         PlayerPlaySound(issuerid,1057,0,0,0);
  47.     }
  48.     return 1;
  49. }
  50.  
  51. CMD:marker(playerid, params[])
  52. {
  53.     ShowPlayerDialog(playerid, DIALOG_ADJUSTMENTS, DIALOG_STYLE_MSGBOX,"HitMarker","{FFFFFF}Do you want to turn the hitmarker {00FF26}ON {FFFFFF}or {FF0000}OFF?","Turn ON","Turn OFF");
  54.     return 1;
  55. }
  56.  
  57. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  58. {
  59.     switch(dialogid)
  60.     {
  61.         case DIALOG_ADJUSTMENTS:
  62.         {
  63.             if ((!response) && (actmarker[playerid] >= 1)) return SendClientMessage(playerid, COLOR_RED, "HitMarker turned OFF."), actmarker[playerid]--;
  64.             else if ((!response) && (actmarker[playerid] <= 0)) return SendClientMessage(playerid, COLOR_RED, "It is already turned OFF!");
  65.             if((response) && (actmarker[playerid] <= 0)) return SendClientMessage(playerid, COLOR_GREEN, "HitMarker turned ON."), actmarker[playerid]++;
  66.             else if ((response) && (actmarker[playerid] >= 1)) return SendClientMessage(playerid, COLOR_GREEN, "It is already turned ON!");
  67.         }
  68.     }
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment