Advertisement
Guest User

Untitled

a guest
May 16th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. /* Unique Deathscript by Saint */
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. #if defined FILTERSCRIPT
  8.  
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("\n--------------------------------------");
  13. print(" Cool Death Script by Saint - Loaded");
  14. print("--------------------------------------\n");
  15. return 1;
  16. }
  17.  
  18. public OnFilterScriptExit()
  19. {
  20. return 1;
  21. }
  22.  
  23. #endif
  24.  
  25. //DeathScript
  26. new PlayerIsDead[MAX_PLAYERS];
  27. new World[MAX_PLAYERS];
  28. new Interior[MAX_PLAYERS];
  29. new Float:deadpos[3];
  30. new DeadSkin[MAX_PLAYERS];
  31. new Fell[MAX_PLAYERS];
  32. new Text3D:injuredlabel[MAX_PLAYERS];
  33. new IsFinishedTimer[MAX_PLAYERS];
  34. new DeathTimerTimer[MAX_PLAYERS];
  35.  
  36. PreloadAnimLib(playerid, animlib[])
  37. {
  38. ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
  39. }
  40.  
  41. bool:HasAnimationApplied(playerid, animlib[], animname[])
  42. {
  43. new l_animlib[32];
  44. new l_animname[32];
  45. GetAnimationName(GetPlayerAnimationIndex(playerid),l_animlib,32,l_animname,32);
  46. if (strcmp(animlib, l_animlib, true) == 0 && strcmp(animname, l_animname, true) == 0)
  47. return true;
  48. return false;
  49. }
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53. Delete3DTextLabel(injuredlabel[playerid]);
  54. Fell[playerid] = 0;
  55. return 1;
  56. }
  57.  
  58. public OnPlayerDisconnect(playerid, reason)
  59. {
  60. Delete3DTextLabel(injuredlabel[playerid]);
  61. Fell[playerid] = 0;
  62. return 1;
  63. }
  64.  
  65. public OnPlayerSpawn(playerid)
  66. {
  67. Fell[playerid] = 0;
  68. PreloadAnimLib(playerid,"WUZI" );
  69. if(PlayerIsDead[playerid] == 1)
  70. {
  71. SetPlayerPos(playerid, deadpos[0], deadpos[1], deadpos[2]);
  72. SetPlayerVirtualWorld(playerid, World[playerid]);
  73. SetPlayerInterior(playerid, Interior[playerid]);
  74. SetPlayerSkin(playerid, DeadSkin[playerid]);
  75. ClearAnimations(playerid);
  76. SetTimerEx("DeathTimer", 1000, 0, "i", playerid);
  77. }
  78. return 1;
  79. }
  80.  
  81. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  82. {
  83. new Float:hp;
  84. GetPlayerHealth(playerid, hp);
  85. if(hp - amount < 35 && Fell[playerid] == 0)
  86. {
  87. DeathScript(playerid);
  88. }
  89. if(hp - amount < 36 && PlayerIsDead[playerid] == 1)
  90. {
  91. ClearAnimations(playerid);
  92. Delete3DTextLabel(injuredlabel[playerid]);
  93. DeathScript(playerid);
  94. }
  95. if(hp - amount < 69 && Fell[playerid] == 1 && HasAnimationApplied(playerid, "WUZI", "CS_Dead_Guy"))
  96. {
  97. SetPlayerHealth(playerid, 99);
  98. Fell[playerid] = 1;
  99. TogglePlayerControllable(playerid, 0);
  100. SendClientMessage(playerid, 0xFF6347FF, "SERVER: You are now dead.");
  101. Update3DTextLabelText(injuredlabel[playerid], 0xFF6347FF, "(( DEAD PLAYER ))");
  102. }
  103. if(hp - amount < 95 && Fell[playerid] == 1)
  104. {
  105. SetPlayerHealth(playerid, 99);
  106. ClearAnimations(playerid);
  107. ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
  108. ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
  109. }
  110. return 1;
  111. }
  112.  
  113. public OnPlayerDeath(playerid, killerid, reason)
  114. {
  115. GetPlayerPos(playerid, deadpos[0], deadpos[1], deadpos[2]);
  116. World[playerid] = GetPlayerVirtualWorld(playerid);
  117. Interior[playerid] = GetPlayerInterior(playerid);
  118. DeadSkin[playerid] = GetPlayerSkin(playerid);
  119. PlayerIsDead[playerid] = 1;
  120. Fell[playerid] = 0;
  121. Delete3DTextLabel(injuredlabel[playerid]);
  122. return 1;
  123. }
  124.  
  125. forward DeathScript(playerid);
  126. public DeathScript(playerid)
  127. {
  128. ClearAnimations(playerid);
  129. new string[128];
  130. SetTimerEx("IsFinished", 250, false, "i", playerid);
  131. for( new i = 0; i <= 100; i ++ ) SendClientMessage(playerid, 0xFFFFFFFF, "");
  132. SetPlayerHealth(playerid, 70);
  133. ResetPlayerWeapons(playerid);
  134. format(string, sizeof(string), "(( INJURED PLAYER ))", playerid);
  135. injuredlabel[playerid] = Create3DTextLabel(string, 0xFF6347FF, 0.0, 0.0, 0.0, 15.0, 0);
  136. Attach3DTextLabelToPlayer(injuredlabel[playerid], playerid, 0.0, 0.0, 0.7);
  137. ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
  138. ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 0, 300000, 0);
  139. SendClientMessage(playerid, 0xFF6347FF, "SERVER: You are currently injured.");
  140. }
  141.  
  142. forward DeathTimer(playerid);
  143. public DeathTimer(playerid)
  144. {
  145. DeathScript(playerid);
  146. KillTimer(DeathTimerTimer[playerid]);
  147. }
  148.  
  149. forward IsFinished(playerid);
  150. public IsFinished(playerid)
  151. {
  152. Fell[playerid] = 1;
  153. KillTimer(IsFinishedTimer[playerid]);
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement