GammixSAMP

pedsdebug.pwn - By Gammix

Apr 30th, 2015
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. //PEDs include debug script
  2.  
  3. //-------------------------------------------------
  4.  
  5. #include <a_samp> //SA-MP team
  6. #include <peds> //Gammix
  7.  
  8. //-------------------------------------------------
  9.  
  10. //formated functions
  11.  
  12. #if defined easy_STRING
  13. #undef easy_STRING
  14. #endif
  15. stock easy_STRING[566];
  16.  
  17. #define SendClientMessagef(%0,%1,%2,%3) \
  18. (format(easy_STRING, 145, %2, %3), SendClientMessage(%0,%1,easy_STRING))
  19.  
  20. #define SendClientMessageToAllf(%0,%1,%2) \
  21. (format(easy_STRING, sizeof(easy_STRING), %1, %2), SendClientMessageToAll(%0, easy_STRING))
  22.  
  23. #define GameTextForPlayerf(%0,%1,%2,%3,%4) \
  24. (format(easy_STRING, sizeof(easy_STRING), %1, %4), GameTextForPlayer(%0, easy_STRING, %2, %3))
  25.  
  26. //-------------------------------------------------
  27.  
  28. main()
  29. {
  30. PED_Connect(15, 1841.9462, -1050.7052, 25.1974, 2.9319);//connecting a random ped!
  31. return 1;
  32. }
  33.  
  34. //-------------------------------------------------
  35.  
  36. public OnPlayerSpawn(playerid)
  37. {
  38. SetPlayerPos(playerid, 1841.9462 + 1, -1050.7052, 25.1974);
  39.  
  40. GivePlayerWeapon(playerid, 33, 100000);//just for weapon shooting test
  41. GivePlayerWeapon(playerid, 22, 100000);
  42. GivePlayerWeapon(playerid, 28, 100000);
  43. GivePlayerWeapon(playerid, 16, 100000);
  44. GivePlayerWeapon(playerid, 35, 100000);
  45. GivePlayerWeapon(playerid, 9, 100000);
  46. return 1;
  47. }
  48.  
  49. //-------------------------------------------------
  50.  
  51. //PEDs include callbacks
  52. public PED_OnConnect(pedid)
  53. {
  54. SendClientMessageToAllf(-1, "DEBUG: PED id %i connected", pedid);
  55. return 1;
  56. }
  57.  
  58. public PED_OnDisconnect(pedid)
  59. {
  60. SendClientMessageToAllf(-1, "DEBUG: PED id %i disconnected", pedid);
  61. return 1;
  62. }
  63.  
  64. public PED_OnStreamIn(pedid, forplayerid)
  65. {
  66. SendClientMessagef(forplayerid, -1, "DEBUG: PED id %i streamed in for you", pedid);
  67. return 1;
  68. }
  69.  
  70. public PED_OnStreamOut(pedid, forplayerid)
  71. {
  72. SendClientMessagef(forplayerid, -1, "DEBUG: PED id %i streamed out for you", pedid);
  73. return 1;
  74. }
  75.  
  76. public PED_OnSpawn(pedid)
  77. {
  78. SendClientMessageToAllf(-1, "DEBUG: PED id %i has spawned", pedid);
  79. return 1;
  80. }
  81.  
  82. public PED_OnTakeDamage(pedid, issuerid, weaponid, Float:amount, bodypart)
  83. {
  84. new name[MAX_PLAYER_NAME];
  85. GetPlayerName(issuerid, name, MAX_PLAYER_NAME);
  86. new weapon[28];
  87. GetWeaponName(weaponid, weapon, sizeof(weapon));
  88. new bodypartname[28];
  89. switch(bodypart)
  90. {
  91. case 3: bodypartname = "Torso";
  92. case 4: bodypartname = "Groin";
  93. case 5: bodypartname = "Left arm";
  94. case 6: bodypartname = "Right arm";
  95. case 7: bodypartname = "Left leg";
  96. case 8: bodypartname = "Right leg";
  97. case 9: bodypartname = "Headshot!";
  98. }
  99. SendClientMessageToAllf(-1, "DEBUG: PED id %i took damage of %0.2f from weapon %s shot by %s on bodypart %s", pedid, amount, weapon, name, bodypartname);
  100. return 1;
  101. }
  102.  
  103. public PED_OnDeath(pedid, killerid, weaponid)
  104. {
  105. new name[MAX_PLAYER_NAME];
  106. GetPlayerName(killerid, name, MAX_PLAYER_NAME);
  107. new weapon[28];
  108. GetWeaponName(weaponid, weapon, sizeof(weapon));
  109. SendClientMessageToAllf(-1, "DEBUG: PED id %i died from weapon %s shot by %s", pedid, weapon, name);
  110. return 1;
  111. }
  112.  
  113. public OnPlayerTargetPED(playerid, pedid, weaponid)
  114. {
  115. new weapon[28];
  116. GetWeaponName(weaponid, weapon, sizeof(weapon));
  117. SendClientMessagef(playerid, -1, "DEBUG: You have targeted PED id %i with %s", pedid, weapon);
  118. return 1;
  119. }
  120.  
  121. public PED_OnUpdate(pedid)
  122. {
  123. //SendClientMessageToAllf(-1, "DEBUG: PED id %i has updated!", pedid);
  124. //this will cause you SPAM in chat !
  125. return 1;
  126. }
  127.  
  128. //-------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment