SHARE
TWEET

Untitled

a guest Jan 24th, 2020 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <foreach>
  3. #include <streamer>
  4. #include <colandreas>
  5.  
  6. #define SNOW_BALL_SLOT 3
  7. new bool:snow_thrown[MAX_PLAYERS char] = {false,...};
  8. new snow_ball[MAX_PLAYERS] = {0,...};
  9. new Float:player_angle[MAX_PLAYERS] = {0.0,...};
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     CA_Init();
  14.     return 1;
  15. }
  16.  
  17. public OnFilterScriptExit()
  18. {
  19.     foreach(new i : Player)
  20.     {
  21.         if(snow_ball[i] == 0) continue;
  22.         RemovePlayerAttachedObject(i, SNOW_BALL_SLOT);
  23.         DestroyDynamicObject(snow_ball[i]);
  24.     }
  25.     return 1;
  26. }
  27.  
  28. public OnPlayerConnect(playerid)
  29. {
  30.     ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 0, 0, 0, 1000, 0);
  31.     return 1;
  32. }
  33.  
  34. public OnPlayerDisconnect(playerid, reason)
  35. {
  36.     if(snow_ball[playerid] != 0)
  37.     {
  38.         snow_thrown{playerid} = false;
  39.         DestroyDynamicObject(snow_ball[playerid]);
  40.         RemovePlayerAttachedObject(playerid, SNOW_BALL_SLOT);
  41.         snow_ball[playerid] = 0;
  42.         player_angle[playerid] = 0.0;
  43.     }
  44.     return 1;
  45. }
  46.  
  47. Float:Speed(playerid)
  48. {
  49.     new Float:x, Float:y, Float:z;
  50.     GetPlayerVelocity(playerid, x, y, z);
  51.     return ((x*x) + (y*y) + (z*z));
  52. }
  53.  
  54. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  55. {
  56.     new Float:x, Float:y, Float:z, Float:a;
  57.     if(newkeys & 65536)
  58.     {
  59.         if(!IsPlayerInAnyVehicle(playerid) && Speed(playerid) == 0.00 && snow_ball [playerid] == 0)
  60.         {
  61.             ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 0, 0, 0, 1000, 1);
  62.             SetPlayerAttachedObject(playerid, SNOW_BALL_SLOT, 1974, 6, 0.05, 0.04, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
  63.             snow_ball[playerid] = CreateDynamicObject(1974, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
  64.         }
  65.     }
  66.     if(newkeys & 4)
  67.     {
  68.         if(!IsPlayerInAnyVehicle(playerid) && snow_ball[playerid] != 0 && !snow_thrown{playerid})
  69.         {
  70.             GetPlayerPos(playerid, x, y, z);
  71.             GetPlayerFacingAngle(playerid, a);
  72.             ApplyAnimation(playerid, "GRENADE", "WEAPON_throw", 4.1, 0, 0, 0, 0, 700, 1);
  73.             RemovePlayerAttachedObject(playerid, SNOW_BALL_SLOT);
  74.             SetDynamicObjectPos(snow_ball[playerid], x, y, z+1.50);
  75.             player_angle[playerid] = a;
  76.             x += 10.0 * floatsin(-a, degrees);
  77.             y += 10.0 * floatcos(-a, degrees);
  78.             MoveDynamicObject(snow_ball[playerid], x, y, z+7.0, 6.0);
  79.             snow_thrown{playerid} = true;
  80.         }
  81.     }
  82.     return 1;
  83. }
  84.  
  85. public OnDynamicObjectMoved(objectid)
  86. {
  87.     new Float:x, Float:y, Float:z, Float:z2;
  88.     foreach(new i : Player)
  89.     {
  90.         if(objectid != snow_ball[i]) continue;
  91.         GetDynamicObjectPos(objectid, x, y, z);
  92.         CA_FindZ_For2DCoord(x, y, z2);
  93.         if(z != z2)
  94.         {
  95.             x += 14.0 * floatsin(-player_angle[i], degrees);
  96.             y += 14.0 * floatcos(-player_angle[i], degrees);
  97.             MoveDynamicObject(snow_ball[i], x, y, z2, 6.8);
  98.             break;
  99.         }
  100.         DestroyDynamicObject(snow_ball[i]);
  101.         snow_ball[i] = 0;
  102.         snow_thrown{i} = false;
  103.         break;
  104.     }
  105.     return 1;
  106. }
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