Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sharkAttack(playerid) {
- CreateObject(1608, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // Creates shark.
- new Float:posx,Float:posy,Float:posz; // Variable creation for coords.
- while (IsPlayerInRangeOfPoint(playerid, 1.0, 0, 0,0) // Arbitrary numbers for end of shore.
- if (IsPlayerInRangeOfPoint(playerid, 40.0, x2, y2, z2)) {
- GetPlayerPos(playerid, posx, posy, posz); // Sets player's coordinates.
- new Float:Health = GetPlayerHealth(playerid,health); // Stores player's HP in Health
- SetObjectToFaceCords(1608, posx, posy, posz); // Faces shark to the player.
- MoveObject(1608,0, 0, 0, 4); // Moves shark in player's direction.
- }
- if (IsPlayerInRangeOfPoint(playerid, 5.0, x2, y2, z2)) { // Range check.
- StopObject(1608); // Stops shark.
- while (IsPlayerInRangeOfPoint(playerid, 5.0, x2, y2, z2)) { // Range check.
- SetTimer("Bite", 2000, false); // Calls Bite()
- }
- public Bite() {
- SetPlayerHealth(playerid, Health-5); // Removes 5 HP from player's health.
- }
Add Comment
Please, Sign In to add comment