Advertisement
Guest User

Untitled

a guest
May 13th, 2017
1,322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.69 KB | None | 0 0
  1. // Entering shamal as passenger v3.1 by BeckzyBoi. (13/05/2017). Requires SA-MP 0.3z R2-2 or later
  2.  
  3. #include <a_samp>
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     print("---------------------------------------");
  8.     print("Loaded 'Entering shamal as passenger'");
  9.     print("v3.1 by BeckzyBoi. (13/05/2017)");
  10.     print("---------------------------------------");
  11.     return 1;
  12. }
  13.  
  14. new sExplode[MAX_VEHICLES] = {-1, ...};
  15. new bool:tCount[MAX_VEHICLES];
  16.  
  17. #define S_EXPLODE_X 2.4015
  18. #define S_EXPLODE_Y 29.2775
  19. #define S_EXPLODE_Z 1199.593
  20. #define S_EXPLODE_RANGE 13.4
  21.  
  22. forward ExplodeShamal(vehicleid);
  23.  
  24. GetPlayerShamalID(playerid)
  25. {
  26.     return GetPlayerVirtualWorld(playerid) > cellmax-MAX_VEHICLES ? cellmax-GetPlayerVirtualWorld(playerid)+1 : 0;
  27. }
  28.  
  29. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  30. {
  31.     if (ispassenger != 0 && GetVehicleModel(vehicleid) == 519)
  32.     {
  33.         SetPlayerVirtualWorld(playerid, cellmax-(vehicleid-1));
  34.         SetPlayerInterior(playerid, 1);
  35.         SetPlayerPos(playerid, 3.839, 22.977, 1199.601);
  36.         SetPlayerFacingAngle(playerid, 90.0);
  37.         SetCameraBehindPlayer(playerid);
  38.     }
  39.     return 1;
  40. }
  41.  
  42. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  43. {
  44.     new vehicleid = GetPlayerShamalID(playerid);
  45.     if (newkeys == 16 && vehicleid != 0)
  46.     {
  47.         new Float:x, Float:y, Float:z, Float:a;
  48.         GetVehiclePos(vehicleid, x, y, z);
  49.         GetVehicleZAngle(vehicleid, a);
  50.         x += (5.0*floatsin(-(a-45.0), degrees));
  51.         y += (5.0*floatcos(-(a-45.0), degrees));
  52.         SetPlayerVirtualWorld(playerid, GetVehicleVirtualWorld(vehicleid));
  53.         SetPlayerInterior(playerid, 0);
  54.         SetPlayerPos(playerid, x, y, z-0.94);
  55.         SetPlayerFacingAngle(playerid, a);
  56.     }
  57.     return 1;
  58. }
  59.  
  60. public OnVehicleDeath(vehicleid, killerid)
  61. {
  62.     if (GetVehicleModel(vehicleid) == 519)
  63.     {
  64.         for (new i = 0; i < MAX_PLAYERS; i++)
  65.         {
  66.             if (GetPlayerShamalID(i) == vehicleid)
  67.             {
  68.                 SetPlayerHealth(i, 0.0);
  69.                 CreateExplosionForPlayer(i, S_EXPLODE_X, S_EXPLODE_Y, S_EXPLODE_Z, 2, S_EXPLODE_RANGE);
  70.             }
  71.         }
  72.         if (sExplode[vehicleid-1] != -1)
  73.         {
  74.             KillTimer(sExplode[vehicleid-1]);
  75.         }
  76.         sExplode[vehicleid-1] = SetTimerEx("ExplodeShamal", 700, 0, "d", vehicleid);
  77.         tCount[vehicleid-1] = true;
  78.     }
  79.     return 1;
  80. }
  81.  
  82. public OnVehicleSpawn(vehicleid)
  83. {
  84.     tCount[vehicleid-1] = false;
  85.     return 1;
  86. }
  87.  
  88. public ExplodeShamal(vehicleid)
  89. {
  90.     KillTimer(sExplode[vehicleid-1]);
  91.     if (tCount[vehicleid-1])
  92.     {
  93.         for (new i = 0; i < MAX_PLAYERS; i++)
  94.         {
  95.             if (GetPlayerShamalID(i) == vehicleid)
  96.             {
  97.                 CreateExplosionForPlayer(i, S_EXPLODE_X, S_EXPLODE_Y, S_EXPLODE_Z, 2, S_EXPLODE_RANGE);
  98.             }
  99.         }
  100.         sExplode[vehicleid-1] = SetTimerEx("ExplodeShamal", random(1300) + 100, 0, "d", vehicleid);
  101.     }
  102.     else
  103.     {
  104.         sExplode[vehicleid-1] = -1;
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement