SHARE
TWEET

Untitled

a guest Oct 15th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // by ino 15/12/15
  2.  
  3. #include <a_samp>
  4. #include <colandreas>
  5.  
  6. new dropitem;
  7.  
  8. public OnPlayerCommandText(playerid, cmdtext[])
  9. {
  10.     if (strcmp("/drop", cmdtext, true, 10) == 0) {
  11.         if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
  12.             SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
  13.         } else {
  14.             DropItem(playerid, 348, -0.01, 1.35, 0.0, 93.7, 120.0);
  15.         }
  16.         return 1;
  17.     }
  18.  
  19.     if (strcmp("/drop2", cmdtext, true, 10) == 0) {
  20.         if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
  21.             SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
  22.         } else {
  23.             DropItem(playerid, 19054, 0.75, 1.6, 0.8, 0.0, 0.0);
  24.         }
  25.         return 1;
  26.     }
  27.  
  28.     if (strcmp("/drop3", cmdtext, true, 10) == 0) {
  29.         if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
  30.             SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
  31.         } else {
  32.             DropItem(playerid, 359, -0.01, 1.35, 0.0, 93.7, 120.0);
  33.         }
  34.         return 1;
  35.     }
  36.  
  37.     if (strcmp("/drop4", cmdtext, true, 10) == 0) {
  38.         if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
  39.             SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
  40.         } else {
  41.             DropItem(playerid, 362, 0.01, 1.35, 0.0, 93.7, 120.0);
  42.         }
  43.         return 1;
  44.     }
  45.     return 0;
  46. }
  47.  
  48. stock DropItem(playerid, object, Float:tolerance, Float:inFrontEnd, Float:inFront, Float:rotateX, Float:rotateY)
  49. {
  50.     new Float:x, Float:y, Float:z, Float:caZ;
  51.     GetPlayerPos(playerid, x, y, z);
  52.     DestroyObject(dropitem);
  53.     GetXYInFrontOfPlayer(playerid, x, y, inFront);
  54.     dropitem = CreateObject(object, x, y, z, rotateX, rotateY, 90.0);
  55.     GetXYInFrontOfPlayer(playerid, x, y, inFrontEnd);
  56.     MoveObject(dropitem, x, y, z + 0.8, 5.80);
  57.     //GetXYInFrontOfPlayer(playerid, x, y, inFront);
  58.     CA_FindGroundZ(x, y, z, caZ);
  59.     ApplyAnimation(playerid, "GRENADE", "WEAPON_throwu", 3.0, 0, 0, 0, 0, 0);
  60.     SetTimerEx("MoveItem", 200, false, "iffff", playerid, x, y, caZ, tolerance);
  61.     return 1;
  62. }
  63.  
  64. forward MoveItem(playerid, Float:x, Float:y, Float:caZ, Float:tolerance);
  65. public MoveItem(playerid, Float:x, Float:y, Float:caZ, Float:tolerance)
  66. {
  67.     MoveObject(dropitem, x, y, caZ + (tolerance), 7.70);
  68.     return 1;
  69. }
  70.  
  71.  
  72. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  73. {
  74.     // Created by Y_Less
  75.  
  76.     new Float:a;
  77.  
  78.     GetPlayerPos(playerid, x, y, a);
  79.     GetPlayerFacingAngle(playerid, a);
  80.  
  81.     if (GetPlayerVehicleID(playerid)) {
  82.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  83.     }
  84.  
  85.     x += (distance * floatsin(-a, degrees));
  86.     y += (distance * floatcos(-a, degrees));
  87. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top