Advertisement
Guest User

Untitled

a guest
Nov 8th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.07 KB | None | 0 0
  1. #include <a_samp>
  2. forward timerforshotimg();
  3.  
  4. new Text:PlayerInfoText0[MAX_PLAYERS];
  5. new Text:PlayerInfoText1[MAX_PLAYERS];
  6. new Text:PlayerInfoText2[MAX_PLAYERS];
  7.  
  8. new PlayerInfoTextStatus[MAX_PLAYERS];
  9. new PlayerInfoTextTime[MAX_PLAYERS];
  10. new DamagePlayrID[MAX_PLAYERS];
  11. new MyName[MAX_PLAYERS][MAX_PLAYER_NAME];
  12.  
  13. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  14. {
  15. //-----------------------------------------------------------
  16. if(issuerid != INVALID_PLAYER_ID)
  17. {
  18. if(PlayerInfoTextStatus[issuerid] == 0)
  19. {
  20. PlayerInfoTextStatus[issuerid] = 2;
  21. TextDrawShowForPlayer(issuerid, PlayerInfoText0[issuerid]);
  22. TextDrawShowForPlayer(issuerid, PlayerInfoText1[issuerid]);
  23. TextDrawShowForPlayer(issuerid, PlayerInfoText2[issuerid]);
  24. }
  25. else if(PlayerInfoTextStatus[issuerid] == 1)
  26. {
  27. TextDrawShowForPlayer(issuerid, PlayerInfoText0[issuerid]);
  28. }
  29. PlayerInfoTextTime[issuerid] = 10;
  30. DamagePlayrID[issuerid] = playerid;
  31.  
  32. new strdmg[25];
  33. new dmg = floatround( amount );
  34. format(strdmg, sizeof(strdmg), "~r~+%d ~w~dmg!",dmg);
  35. TextDrawSetString(PlayerInfoText0[issuerid], strdmg);
  36.  
  37. new strname[30];
  38. format(strname, sizeof(strname), "~w~%s",MyName[playerid]);
  39. TextDrawSetString(PlayerInfoText1[issuerid], strname);
  40.  
  41. new Float:health;
  42. GetPlayerHealth(playerid, health);
  43. new hp = floatround( health );
  44.  
  45. new Float:armor;
  46. GetPlayerArmour(playerid, armor);
  47. new arm = floatround( armor );
  48.  
  49. new gunname[32];
  50. GetWeaponName(GetPlayerWeapon(playerid),gunname,sizeof(gunname));
  51.  
  52. new strinfo[128];
  53. format(strinfo, sizeof(strinfo), "~w~HP: ~y~%d~n~~w~Armor: ~y~%d~n~~w~Ping: ~y~%d ~y~ms~n~~w~Gun: ~y~%s",hp,arm,GetPlayerPing(playerid),gunname);
  54. TextDrawSetString(PlayerInfoText2[issuerid], strinfo);
  55. }
  56. //-----------------------------------------------------------
  57. return 1;
  58. }
  59.  
  60. public OnPlayerConnect(playerid)
  61. {
  62. GetPlayerName(playerid, MyName[playerid],MAX_PLAYER_NAME);
  63. PlayerInfoTextStatus[playerid] = 0;PlayerInfoTextTime[playerid] = 0;DamagePlayrID[playerid] = -1;
  64.  
  65. PlayerInfoText0[playerid] = TextDrawCreate(414.000000, 320.000000, "Loading...");
  66. TextDrawBackgroundColor(PlayerInfoText0[playerid], 255);
  67. TextDrawFont(PlayerInfoText0[playerid], 1);
  68. TextDrawLetterSize(PlayerInfoText0[playerid], 1.000000, 2.000000);
  69. TextDrawColor(PlayerInfoText0[playerid], -1);
  70. TextDrawSetOutline(PlayerInfoText0[playerid], 0);
  71. TextDrawSetProportional(PlayerInfoText0[playerid], 1);
  72. TextDrawSetShadow(PlayerInfoText0[playerid], 1);
  73. TextDrawSetSelectable(PlayerInfoText0[playerid], 0);
  74.  
  75. PlayerInfoText1[playerid] = TextDrawCreate(400.000000, 343.000000, "Loading...");
  76. TextDrawBackgroundColor(PlayerInfoText1[playerid], 255);
  77. TextDrawFont(PlayerInfoText1[playerid], 1);
  78. TextDrawLetterSize(PlayerInfoText1[playerid], 1.000000, 2.000000);
  79. TextDrawColor(PlayerInfoText1[playerid], -1);
  80. TextDrawSetOutline(PlayerInfoText1[playerid], 0);
  81. TextDrawSetProportional(PlayerInfoText1[playerid], 1);
  82. TextDrawSetShadow(PlayerInfoText1[playerid], 1);
  83. TextDrawSetSelectable(PlayerInfoText1[playerid], 0);
  84.  
  85. PlayerInfoText2[playerid] = TextDrawCreate(403.000000, 364.000000, "Loading...");
  86. TextDrawBackgroundColor(PlayerInfoText2[playerid], 255);
  87. TextDrawFont(PlayerInfoText2[playerid], 1);
  88. TextDrawLetterSize(PlayerInfoText2[playerid], 0.500000, 1.000000);
  89. TextDrawColor(PlayerInfoText2[playerid], -1);
  90. TextDrawSetOutline(PlayerInfoText2[playerid], 0);
  91. TextDrawSetProportional(PlayerInfoText2[playerid], 1);
  92. TextDrawSetShadow(PlayerInfoText2[playerid], 1);
  93. TextDrawUseBox(PlayerInfoText2[playerid], 1);
  94. TextDrawBoxColor(PlayerInfoText2[playerid], 842150450);
  95. TextDrawTextSize(PlayerInfoText2[playerid], 594.000000, 0.000000);
  96. TextDrawSetSelectable(PlayerInfoText2[playerid], 0);
  97. return 1;
  98. }
  99.  
  100. public OnPlayerDisconnect(playerid, reason)
  101. {
  102. TextDrawDestroy(PlayerInfoText0[playerid]);
  103. TextDrawDestroy(PlayerInfoText1[playerid]);
  104. TextDrawDestroy(PlayerInfoText2[playerid]);
  105. return 1;
  106. }
  107.  
  108. public OnFilterScriptInit()
  109. {
  110. SetTimer("timerforshotimg", 1000, 1);
  111. return 1;
  112. }
  113.  
  114. public timerforshotimg()
  115. {
  116. for(new i = 0; i < MAX_PLAYERS; i++)
  117. {
  118. if(IsPlayerConnected(i))
  119. {
  120. if(PlayerInfoTextStatus[i] > 0)
  121. {
  122. if(PlayerInfoTextTime[i] > 0)
  123. {
  124. PlayerInfoTextTime[i]--;
  125.  
  126. new damagedid = DamagePlayrID[i];
  127.  
  128. if(PlayerInfoTextTime[i] == 6)
  129. {
  130. PlayerInfoTextStatus[i] = 1;
  131. TextDrawHideForPlayer(i, PlayerInfoText0[i]);
  132. }
  133.  
  134. //-----------------------------------------------------------
  135.  
  136. new strname[30];
  137. format(strname, sizeof(strname), "~w~%s",MyName[damagedid]);
  138. TextDrawSetString(PlayerInfoText1[i], strname);
  139.  
  140. //-----------------------------------------------------------
  141.  
  142. new Float:health;
  143. GetPlayerHealth(damagedid, health);
  144. new hp = floatround( health );
  145.  
  146. new Float:armor;
  147. GetPlayerArmour(damagedid, armor);
  148. new arm = floatround( armor );
  149.  
  150. new gunname[32];
  151. GetWeaponName(GetPlayerWeapon(damagedid),gunname,sizeof(gunname));
  152.  
  153. new strinfo[128];
  154. format(strinfo, sizeof(strinfo), "~w~HP: ~y~%d~n~~w~Armor: ~y~%d~n~~w~Ping: ~y~%d ~y~ms~n~~w~Gun: ~y~%s",hp,arm,GetPlayerPing(damagedid),gunname);
  155. TextDrawSetString(PlayerInfoText2[i], strinfo);
  156.  
  157. if(PlayerInfoTextTime[i] == 0)
  158. {
  159. PlayerInfoTextStatus[i] = 0;
  160. TextDrawHideForPlayer(i, PlayerInfoText0[i]);
  161. TextDrawHideForPlayer(i, PlayerInfoText1[i]);
  162. TextDrawHideForPlayer(i, PlayerInfoText2[i]);
  163. }
  164. }
  165. }
  166. }
  167. }
  168. return 1;
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement