Guest User

Untitled

a guest
Feb 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. public sharkAttack(playerid) {
  2. CreateObject(1608, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // Creates shark.
  3. new Float:posx,Float:posy,Float:posz; // Variable creation for coords.
  4. while (IsPlayerInRangeOfPoint(playerid, 1.0, 0, 0,0) // Arbitrary numbers for end of shore.
  5. if (IsPlayerInRangeOfPoint(playerid, 40.0, x2, y2, z2)) {
  6. GetPlayerPos(playerid, posx, posy, posz); // Sets player's coordinates.
  7. new Float:Health = GetPlayerHealth(playerid,health); // Stores player's HP in Health
  8. SetObjectToFaceCords(1608, posx, posy, posz); // Faces shark to the player.
  9. MoveObject(1608,0, 0, 0, 4); // Moves shark in player's direction.
  10. }
  11. if (IsPlayerInRangeOfPoint(playerid, 5.0, x2, y2, z2)) { // Range check.
  12. StopObject(1608); // Stops shark.
  13. while (IsPlayerInRangeOfPoint(playerid, 5.0, x2, y2, z2)) { // Range check.
  14. SetTimer("Bite", 2000, false); // Calls Bite()
  15. }
  16.  
  17. public Bite() {
  18. SetPlayerHealth(playerid, Health-5); // Removes 5 HP from player's health.
  19. }
Add Comment
Please, Sign In to add comment