MistarA

Untitled

Nov 28th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. #include <a_samp>
  2. #include <core>
  3. #include <float>
  4. #include <zcmd>
  5.  
  6.  
  7. #pragma tabsize 0
  8.  
  9.  
  10. #define COLOR_LIGHTRED 0xFF6347AA // 0xB33C3CAA
  11. #define COL_RED "{B33C3C}"
  12. new Text3D:deathlabel[MAX_PLAYERS];
  13. new bool:isAlive[MAX_PLAYERS];
  14. new bool:stopanimAllowed[MAX_PLAYERS];
  15. new Float:Deadx[MAX_PLAYERS], Float:Deady[MAX_PLAYERS], Float:Deadz[MAX_PLAYERS];
  16. new deadvw[MAX_PLAYERS];
  17. new deadint[MAX_PLAYERS];
  18. new oldskin[MAX_PLAYERS];
  19. new killed[MAX_PLAYERS];
  20.  
  21. enum pInfo
  22. {
  23. pWeapon1,
  24. pWeapon2,
  25. pWeapon3,
  26. pWeapon4,
  27. pWeapon5,
  28. pWeapon6,
  29. pWeapon7,
  30. pWeapon8,
  31. pWeapon9,
  32. pWeapon10,
  33. pWeapon11,
  34. pWeapon12,
  35. pWeapon13,
  36. pWeapon14
  37. }
  38.  
  39. enum E_SHOT_INFO
  40. {
  41. Chest,
  42. Crotch,
  43. LArm,
  44. RArm,
  45. LLeg,
  46. RLeg,
  47. Head,
  48. Misc
  49. }
  50. new sInfo[MAX_PLAYERS][E_SHOT_INFO];
  51. forward ResetPlayerStats(playerid);
  52. forward OperationDone(playerid);
  53.  
  54. main()
  55. {
  56. print("\n----------------------------------");
  57. print(" Bare Script\n");
  58. print("----------------------------------\n");
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63. GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
  64. ResetPlayerStats(playerid);
  65. return 1;
  66. }
  67.  
  68. public OnPlayerCommandText(playerid, cmdtext[])
  69. {
  70. new idx;
  71. new cmd[256];
  72.  
  73. cmd = strtok(cmdtext, idx);
  74.  
  75. if(strcmp(cmd, "/yadayada", true) == 0) {
  76. return 1;
  77. }
  78.  
  79. return 0;
  80. }
  81.  
  82. public OnPlayerSpawn(playerid)
  83. {
  84. SetPlayerInterior(playerid,0);
  85. TogglePlayerClock(playerid,0);
  86. sInfo[playerid][Misc] = 0;
  87. sInfo[playerid][Head] = 0;
  88. sInfo[playerid][Chest] = 0;
  89. sInfo[playerid][Crotch] = 0;
  90. sInfo[playerid][LArm] = 0;
  91. sInfo[playerid][RArm] = 0;
  92. sInfo[playerid][LLeg] = 0;
  93. sInfo[playerid][RLeg] = 0;
  94.  
  95. if(isAlive[playerid] == false)
  96. {
  97. SetPlayerPos(playerid, Deadx[playerid], Deady[playerid], Deadz[playerid]);
  98. SetPlayerInterior(playerid, deadint[playerid]);
  99. SetPlayerVirtualWorld(playerid, deadvw[playerid]);
  100. stopanimAllowed[playerid] = false;
  101. SendClientMessage(playerid, COLOR_LIGHTRED, "You're currently brutally wounded. If no-one helps you, you will die. /acceptdeath if you wish to give up.");
  102. TogglePlayerControllable(playerid,0);
  103. SetTimerEx("LoadDeathAnim", 1000, false, "i", playerid);
  104. SetPlayerSkin(playerid, oldskin[playerid]);
  105. for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
  106.  
  107. new string[400];
  108. new holder[400];
  109.  
  110.  
  111. if(sInfo[playerid][Misc] > 0)
  112. {
  113. format(string, sizeof(string), ""COL_RED"%d bruises on their body.\n", sInfo[playerid][Misc]);
  114. strcat(holder, string, sizeof(holder));
  115. }
  116. if(sInfo[playerid][Head] > 0)
  117. {
  118. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the head.\n", sInfo[playerid][Head]);
  119. strcat(holder, string, sizeof(holder));
  120. }
  121. if(sInfo[playerid][Chest] > 0)
  122. {
  123. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the chest.\n", sInfo[playerid][Chest]);
  124. strcat(holder, string, sizeof(holder));
  125. }
  126. if(sInfo[playerid][Crotch] > 0)
  127. {
  128. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the crotch.\n", sInfo[playerid][Crotch]);
  129. strcat(holder, string, sizeof(holder));
  130. }
  131. if(sInfo[playerid][LArm] > 0)
  132. {
  133. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the left arm.\n", sInfo[playerid][LArm]);
  134. strcat(holder, string, sizeof(holder));
  135. }
  136. if(sInfo[playerid][RArm] > 0)
  137. {
  138. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the right arm.\n", sInfo[playerid][RArm]);
  139. strcat(holder, string, sizeof(holder));
  140. }
  141. if(sInfo[playerid][LLeg] > 0)
  142. {
  143. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the left leg.\n", sInfo[playerid][LLeg]);
  144. strcat(holder, string, sizeof(holder));
  145. }
  146. if(sInfo[playerid][RLeg] > 0)
  147. {
  148. format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the right leg.\n", sInfo[playerid][RLeg]);
  149. strcat(holder, string, sizeof(holder));
  150. }
  151. deathlabel[playerid] = Create3DTextLabel(holder, -1, Deadx[playerid], Deady[playerid], Deadz[playerid], 10.0, 0, 0);
  152. }
  153.  
  154. return 1;
  155. }
  156.  
  157. public OnPlayerDeath(playerid, killerid, reason)
  158. {
  159. isAlive[playerid] = false;
  160. return 1;
  161. }
  162.  
  163. SetupPlayerForClassSelection(playerid)
  164. {
  165. SetPlayerInterior(playerid,14);
  166. SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  167. SetPlayerFacingAngle(playerid, 270.0);
  168. SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  169. SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  170. }
  171.  
  172. public OnPlayerRequestClass(playerid, classid)
  173. {
  174. SetupPlayerForClassSelection(playerid);
  175. return 1;
  176. }
  177.  
  178.  
  179. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  180. {
  181. new Float:HP;
  182. GetPlayerHealth(playerid, HP);
  183. if(weaponid == 4) SetPlayerHealth(playerid, HP-30);
  184. if(weaponid == 22) SetPlayerHealth(playerid, HP-25);
  185. if(weaponid == 32) SetPlayerHealth(playerid, HP-25);
  186. if(weaponid == 28) SetPlayerHealth(playerid, HP-25);
  187. if(weaponid == 30) SetPlayerHealth(playerid, HP-30);
  188. if(weaponid == 31) SetPlayerHealth(playerid, HP-21);
  189. if(weaponid == 34) SetPlayerHealth(playerid, HP-70);
  190. if(weaponid == 29) SetPlayerHealth(playerid, HP-25);
  191.  
  192. if(weaponid == 25) SetPlayerHealth(playerid, HP-40);
  193.  
  194. if(!IsPlayerConnected(playerid)) return 0;
  195. if(!IsPlayerConnected(issuerid)) return 0;
  196.  
  197. if(issuerid != INVALID_PLAYER_ID)
  198. {
  199. if(weaponid == 0 || weaponid == 1 || weaponid == 2 || weaponid == 3 || weaponid == 4 || weaponid == 5 ||
  200. weaponid == 6 || weaponid == 7 || weaponid == 8 || weaponid == 15)
  201. {
  202. sInfo[playerid][Misc] += 1;
  203. }
  204. }
  205. if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
  206. {
  207. SetPlayerHealth(playerid, 0.0);
  208. }
  209. if(issuerid != INVALID_PLAYER_ID && bodypart == 3)
  210. {
  211. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  212. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  213. {
  214. sInfo[playerid][Chest] += 1;
  215. }
  216. }
  217. if(issuerid != INVALID_PLAYER_ID && bodypart == 4)
  218. {
  219. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  220. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  221. {
  222. sInfo[playerid][Crotch] += 1;
  223. }
  224. }
  225. if(issuerid != INVALID_PLAYER_ID && bodypart == 5)
  226. {
  227. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  228. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  229. {
  230. sInfo[playerid][LArm] += 1;
  231. }
  232. }
  233. if(issuerid != INVALID_PLAYER_ID && bodypart == 6)
  234. {
  235. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  236. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  237. {
  238. sInfo[playerid][RArm] += 1;
  239. }
  240. }
  241. if(issuerid != INVALID_PLAYER_ID && bodypart == 7)
  242. {
  243. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  244. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  245. {
  246. sInfo[playerid][LLeg] += 1;
  247. }
  248. }
  249. if(issuerid != INVALID_PLAYER_ID && bodypart == 8)
  250. {
  251. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  252. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  253. {
  254. sInfo[playerid][RLeg] += 1;
  255. }
  256. }
  257. if(issuerid != INVALID_PLAYER_ID && bodypart == 9)
  258. {
  259. if(weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 ||
  260. weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34)
  261. {
  262. SetPlayerHealth(playerid, HP-70);
  263. sInfo[playerid][Head] += 1;
  264. }
  265. }
  266. return 1;
  267. }
  268.  
  269. public OnGameModeInit()
  270. {
  271. SetGameModeText("Bare Script");
  272. ShowPlayerMarkers(1);
  273. ShowNameTags(1);
  274. AllowAdminTeleport(1);
  275.  
  276. AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
  277.  
  278. return 1;
  279. }
  280.  
  281.  
  282. public ResetPlayerStats(playerid)
  283. {
  284. sInfo[playerid][Misc] = 0;
  285. sInfo[playerid][Head] = 0;
  286. sInfo[playerid][Chest] = 0;
  287. sInfo[playerid][Crotch] = 0;
  288. sInfo[playerid][LArm] = 0;
  289. sInfo[playerid][RArm] = 0;
  290. sInfo[playerid][LLeg] = 0;
  291. sInfo[playerid][RLeg] = 0;
  292. isAlive[playerid] = true;
  293. }
  294.  
  295. strtok(const string[], &index)
  296. {
  297. new length = strlen(string);
  298. while ((index < length) && (string[index] <= ' '))
  299. {
  300. index++;
  301. }
  302.  
  303. new offset = index;
  304. new result[20];
  305. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  306. {
  307. result[index - offset] = string[index];
  308. index++;
  309. }
  310. result[index - offset] = EOS;
  311. return result;
  312. }
  313.  
  314. public OperationDone(playerid)
  315. {
  316. // FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
  317. SendClientMessage(playerid, -1, "You have been treated at the hospital. The hospital bill is $50.");
  318. SetPlayerPos(playerid, 2034.1787,-1401.6705,17.2949);
  319. GivePlayerMoney(playerid, -50);
  320. SetPlayerHealth(playerid, 90.0);
  321. ClearAnimations(playerid);
  322. TogglePlayerControllable(playerid, 1);
  323. SetPlayerInterior(playerid, 0);
  324. SetPlayerVirtualWorld(playerid, 0);
  325. ResetPlayerWeapons(playerid);
  326. return 1;
  327. }
  328.  
  329. CMD:acceptdeath(playerid, params[])
  330. {
  331. if(isAlive[playerid] == false)
  332. {
  333. SendClientMessage(playerid, COLOR_LIGHTRED, "You have been rushed to the hospital and are undergoing an operation.");
  334. SetPlayerPos(playerid, -211.3207,-1759.6207,676.7153);
  335. SetPlayerInterior(playerid, 3);
  336. SetPlayerVirtualWorld(playerid, 0);
  337. // FadeColorForPlayer(playerid,0,0,0,0,0,0,0,255,15,0);
  338. SetTimerEx("OperationDone", 15000, false, "i", playerid);
  339. isAlive[playerid] = true;
  340. //ApplyPlayerAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1,1);
  341. Delete3DTextLabel(deathlabel[playerid]);
  342. sInfo[playerid][Chest] = 0;
  343. sInfo[playerid][Head] = 0;
  344. sInfo[playerid][Crotch] = 0;
  345. sInfo[playerid][RLeg] = 0;
  346. sInfo[playerid][LLeg] = 0;
  347. sInfo[playerid][RArm] = 0;
  348. sInfo[playerid][LArm] = 0;
  349. killed[playerid] = 0;
  350. }
  351. else
  352. {
  353. SendClientMessage(playerid, -1, "nu merge bos");
  354. }
  355. return 1;
  356. }
Advertisement
Add Comment
Please, Sign In to add comment