From b1d8beb23bb3ac3faba349b5a99f128a35c7583d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 17 Jul 2022 04:24:18 -0500 Subject: [PATCH] Fix fishing stuff (unfinished) --- scripts/server/fishing.js | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/scripts/server/fishing.js b/scripts/server/fishing.js index 978dcfb1..43543278 100644 --- a/scripts/server/fishing.js +++ b/scripts/server/fishing.js @@ -52,7 +52,7 @@ function initFishingScript() { // =========================================================================== function castFishingLineCommand(client) { - if (isPlayerInFishingSpot(client)) { + if (!isPlayerInFishingSpot(client)) { messagePlayerError(client, getLocaleString(client, "CantFishHere")); return false; } @@ -63,11 +63,11 @@ function castFishingLineCommand(client) { } getPlayerData(client).fishingLineCastStart = getCurrentUnixTimestamp(); - makePedPlayAnimation(getPlayerPed(client), getAnimationFromParams("batswing")); + makePedPlayAnimation(getPlayerPed(client), getAnimationFromParams("fishingcast")); - let messageText = getLocaleString(client, "FishingCastCommandHelp") + let messageText = getLocaleString(client, "FishingCastCommandHelp"); if (doesPlayerHaveKeyBindForCommand(client, "fish")) { - messageText = getLocaleString(client, "FishingCastKeyPressHelp") + messageText = getLocaleString(client, "FishingCastKeyPressHelp"); } showGameMessage(client, messageText); @@ -82,18 +82,26 @@ function resetFishingLineCommand(client) { } if (doesPlayerHaveItemOfUseTypeEquipped(client, AGRP_ITEM_USE_TYPE_FISHINGROD)) { + messagePlayerError(client, getLocaleString(client, "NeedFishingRod")); + return false; + } + + if (!isPlayerInFishingSpot(client)) { messagePlayerError(client, getLocaleString(client, "CantFishHere")); return false; } makePedStopAnimation(getPlayerPed(client)); - let messageText = getLocaleString(client, "FishingCastCommandHelp") + let messageText = getLocaleString(client, "FishingCastCommandHelp"); if (doesPlayerHaveKeyBindForCommand(client, "fish")) { - messageText = getLocaleString(client, "FishingCastKeyPressHelp") + messageText = getLocaleString(client, "FishingCastKeyPressHelp"); } showGameMessage(client, messageText); + + getPlayerData(client).fishingLineState = AGRP_FISHING_LINE_STATE_NONE; + getPlayerData(client).fishingLineCastStart = 0; } // =========================================================================== @@ -119,4 +127,16 @@ function isPlayerInFishingSpot(client) { return false; } +// =========================================================================== + +function isPlayerFishing(client) { + return (getPlayerData(client).fishingLineState != AGRP_FISHING_LINE_STATE_NONE); +} + +// =========================================================================== + +function isPlayerFishing(client) { + return (getPlayerData(client).fishingLineState != AGRP_FISHING_LINE_STATE_NONE); +} + // =========================================================================== \ No newline at end of file