domo101

[FS] System granate

Aug 16th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. #pragma tabsize 0
  2. #include <a_samp>
  3. #include <zcmd>
  4. #define MAX_BOMBE 999
  5. new Bacene[MAX_PLAYERS];
  6. new Objekt[MAX_PLAYERS], Float: gX, Float: gY, Float: gZ;
  7.  
  8. public OnPlayerConnect(playerid)
  9. {
  10. Bacene[playerid] = 0;
  11. }
  12.  
  13.  
  14. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  15. {
  16. new playerState = GetPlayerState(playerid);
  17. new weaponid, ammo;
  18. GetPlayerWeaponData(playerid, 8, weaponid, ammo);
  19. #define PRESSED(%0) \
  20. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  21. if(PRESSED(KEY_YES) && (playerState == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER) && Bacene[playerid] == 0 && weaponid == WEAPON_GRENADE && ammo > 0)
  22. {
  23. new Float: X, Float: Y, Float: Z;
  24. GetPlayerPos(playerid, X, Y, Z);
  25. gX = X, gY = Y-5, gZ = Z;
  26. Objekt[playerid] = CreateObject(342, gX, gY, gZ, 0.0, 0.0, 0.0, 10.0);
  27. SetTimer("eksplozija", 900, false);
  28. Bacene[playerid] = true;
  29. SendClientMessage(playerid, -1, "Bacio si bombu");
  30. GivePlayerWeapon(playerid, WEAPON_GRENADE, -1);
  31. }
  32. else if(Bacene[playerid] == 1) { return 0;}
  33. else if(weaponid == WEAPON_GRENADE && ammo == 0) { return 0; }
  34. return 1;
  35. }
  36.  
  37. forward eksplozija(playerid);
  38. public eksplozija(playerid)
  39. {
  40. CreateExplosion(gX, gY, gZ, 0, 5.0);
  41. DestroyObject(Objekt[playerid]);
  42. Bacene[playerid] = false;
  43. return 1;
  44. }
  45.  
  46. CMD:bomba(playerid, params[]) // test komanda
  47. {
  48. GivePlayerWeapon(playerid, WEAPON_GRENADE, 50 );
  49. return 1;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment