Guest User

Ovni v2.0

a guest
Jun 23rd, 2012
1,759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. //Ovni by adri1
  2. //Idea: SnickertS
  3. //Ovni v2.0 Now in Hydra too by adri1
  4. #include <a_samp>
  5. // On foot
  6. new Ovni[MAX_PLAYERS];
  7. new Light[MAX_PLAYERS];
  8. new bomb;
  9. forward HideBomb();
  10. //On Plane Hydra
  11. new Ovni2[MAX_PLAYERS];
  12. new Light2[MAX_PLAYERS];
  13. new SpawnAuto[MAX_PLAYERS];
  14. public OnPlayerConnect(playerid)
  15. {
  16. Ovni[playerid] = 0;
  17. Light[playerid] = 0;
  18.  
  19. Ovni2[playerid] = 0;
  20. Light2[playerid] = 0;
  21. return 1;
  22. }
  23. public OnPlayerDisconnect(playerid)
  24. {
  25. Ovni[playerid] = 0;
  26. Light[playerid] = 0;
  27.  
  28. Ovni2[playerid] = 0;
  29. Light2[playerid] = 0;
  30. }
  31. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  32. {
  33. if(!IsPlayerInAnyVehicle(playerid))
  34. {
  35. if(Ovni[playerid] == 1)
  36. {
  37. if (newkeys & KEY_FIRE)
  38. {
  39. new Float:x,Float:y,Float:z,Float:a;
  40. GetPlayerPos(playerid,x,y,z);
  41. GetPlayerFacingAngle(playerid,a);
  42. bomb = CreateObject(3786, x, y, z-2, 0, 0, a-90);
  43. MoveObject(bomb, x, y, z-300, 30.0);
  44. SetTimer("HideBomb",1000,0);
  45. }
  46. else if (newkeys & KEY_YES)
  47. {
  48. if(Light[playerid] == 0)
  49. {
  50. SetPlayerAttachedObject(playerid,5,18656,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
  51. Light[playerid] = 1;
  52. }
  53. else if(Light[playerid] == 1)
  54. {
  55. SetPlayerAttachedObject(playerid,5,18657,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
  56. Light[playerid] = 2;
  57. }
  58. else if(Light[playerid] == 2)
  59. {
  60. SetPlayerAttachedObject(playerid,5,18658,1,0.918999,-0.342001,-0.760999,-12.000008,0.000000,90.000,1.000000,1.000000,1.000000);
  61. Light[playerid] = 0;
  62. }
  63. }
  64. else if (newkeys & KEY_NO)
  65. {
  66. RemovePlayerAttachedObject(playerid, 5);
  67. Light[playerid] = 0;
  68. }
  69. }
  70. }
  71. else if(IsPlayerInAnyVehicle(playerid))
  72. {
  73. if(Ovni2[playerid] == 1)
  74. {
  75. if (newkeys & KEY_YES)
  76. {
  77. if(Light2[playerid] == 0)
  78. {
  79. SetPlayerAttachedObject(playerid,3,18656,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
  80. Light2[playerid] = 1;
  81. }
  82. else if(Light2[playerid] == 1)
  83. {
  84. SetPlayerAttachedObject(playerid,3,18657,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
  85. Light2[playerid] = 2;
  86. }
  87. else if(Light2[playerid] == 2)
  88. {
  89. SetPlayerAttachedObject(playerid,3,18658,1,5.162999,-0.976000,-4.204011,0.000000,-2.100000,106.999916,4.111006,2.611997,5.209000);
  90. Light2[playerid] = 0;
  91. }
  92. }
  93. else if (newkeys & KEY_NO)
  94. {
  95. RemovePlayerAttachedObject(playerid, 3);
  96. Light2[playerid] = 0;
  97. }
  98. }
  99. }
  100. return 1;
  101. }
  102. public OnPlayerExitVehicle(playerid, vehicleid)
  103. {
  104. if(Ovni2[playerid] == 1)
  105. {
  106. for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
  107. {
  108. if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
  109. Ovni2[playerid] = 0;
  110. }
  111. }
  112. return 1;
  113. }
  114. public OnPlayerCommandText(playerid, cmdtext[])
  115. {
  116. if(!strcmp(cmdtext, "/ovni", true))
  117. {
  118. if(Ovni[playerid] == 0)
  119. {
  120. SetPlayerAttachedObject(playerid,0,3515,1,-0.609999,0.000000,-0.003999,0.000000,90.900000,0.000000,0.832001,0.818000,0.553001);
  121. SetPlayerAttachedObject(playerid,1,18843,1,-0.712000,0.000000,0.000000,0.000000,0.000000,0.000000,0.014000,0.015000,0.016000);
  122. SetPlayerAttachedObject(playerid,2,3515,1,0.133001,-0.011000,0.017000,0.000000,-90.000000,0.000000,0.818000,0.772001,0.359001);
  123. SetPlayerAttachedObject(playerid,3,18843,1,0.074999,-0.017000,0.026999,0.000000,0.000000,0.000000,0.019000,0.020000,0.020000);
  124. Ovni[playerid] = 1;
  125. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
  126. }
  127. else if(Ovni[playerid] == 1)
  128. {
  129. for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
  130. {
  131. if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
  132. Ovni[playerid] = 0;
  133. }
  134. }
  135. return 1;
  136. }
  137. if(!strcmp(cmdtext, "/ovni2", true))
  138. {
  139. if(Ovni2[playerid] == 0)
  140. {
  141. SetPlayerAttachedObject(playerid,0,3515,1,1.281999,-1.577000,-0.281000,-0.499999,90.800125,-0.599996,4.183998,4.936002,2.922001);
  142. SetPlayerAttachedObject(playerid,1,3515,1,5.023988,-1.466000,-0.072000,0.199999,-89.300010,8.799994,4.148001,4.529000,1.617000);
  143. SetPlayerAttachedObject(playerid,2,18843,1,4.163002,-1.490000,0.000000,0.000000,0.000000,0.000000,0.089000,0.117999,0.099000);
  144. Ovni2[playerid] = 1;
  145. CrearVehiculo(playerid, 520);
  146. }
  147. else if(Ovni2[playerid] == 1)
  148. {
  149. for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
  150. {
  151. if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
  152. Ovni2[playerid] = 0;
  153. }
  154. }
  155. return 1;
  156. }
  157. return 0;
  158. }
  159. public OnPlayerDeath(playerid, killerid, reason)
  160. {
  161. if(Ovni[playerid] == 1)
  162. {
  163. for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
  164. {
  165. if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
  166. }
  167. }
  168. return 1;
  169. }
  170. public HideBomb()
  171. {
  172. new Float:x, Float:y, Float:z;
  173. GetObjectPos(bomb, x, y, z);
  174. DestroyObject(bomb);
  175. CreateExplosion(x, y, z, 2, 200.0);
  176. return 1;
  177. }
  178. CrearVehiculo(playerid, modelid)
  179. {
  180. new Auto, Float:x,Float:y,Float:z,Float:angulo;
  181. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  182. {
  183. Auto = GetPlayerVehicleID(playerid);
  184. GetVehiclePos(Auto, x, y, z);
  185. GetVehicleZAngle(Auto, angulo);
  186. }
  187. else
  188. {
  189. GetPlayerPos(playerid, x, y, z);
  190. GetPlayerFacingAngle(playerid, angulo);
  191. }
  192. if(SpawnAuto[playerid] != 0)DestroyVehicle(SpawnAuto[playerid]);
  193. SpawnAuto[playerid] = CreateVehicle(modelid,x,y,z,angulo,-1,-1,60);
  194. PutPlayerInVehicle(playerid,SpawnAuto[playerid],0);
  195. LinkVehicleToInterior(Auto, GetPlayerInterior(playerid));
  196. SetVehicleVirtualWorld(Auto, GetPlayerVirtualWorld(playerid));
  197. return 1;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment