Fix fishing stuff (unfinished)

This commit is contained in:
Vortrex
2022-07-17 04:24:18 -05:00
parent 25e79b26d6
commit b1d8beb23b

View File

@@ -52,7 +52,7 @@ function initFishingScript() {
// =========================================================================== // ===========================================================================
function castFishingLineCommand(client) { function castFishingLineCommand(client) {
if (isPlayerInFishingSpot(client)) { if (!isPlayerInFishingSpot(client)) {
messagePlayerError(client, getLocaleString(client, "CantFishHere")); messagePlayerError(client, getLocaleString(client, "CantFishHere"));
return false; return false;
} }
@@ -63,11 +63,11 @@ function castFishingLineCommand(client) {
} }
getPlayerData(client).fishingLineCastStart = getCurrentUnixTimestamp(); 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")) { if (doesPlayerHaveKeyBindForCommand(client, "fish")) {
messageText = getLocaleString(client, "FishingCastKeyPressHelp") messageText = getLocaleString(client, "FishingCastKeyPressHelp");
} }
showGameMessage(client, messageText); showGameMessage(client, messageText);
@@ -82,18 +82,26 @@ function resetFishingLineCommand(client) {
} }
if (doesPlayerHaveItemOfUseTypeEquipped(client, AGRP_ITEM_USE_TYPE_FISHINGROD)) { if (doesPlayerHaveItemOfUseTypeEquipped(client, AGRP_ITEM_USE_TYPE_FISHINGROD)) {
messagePlayerError(client, getLocaleString(client, "NeedFishingRod"));
return false;
}
if (!isPlayerInFishingSpot(client)) {
messagePlayerError(client, getLocaleString(client, "CantFishHere")); messagePlayerError(client, getLocaleString(client, "CantFishHere"));
return false; return false;
} }
makePedStopAnimation(getPlayerPed(client)); makePedStopAnimation(getPlayerPed(client));
let messageText = getLocaleString(client, "FishingCastCommandHelp") let messageText = getLocaleString(client, "FishingCastCommandHelp");
if (doesPlayerHaveKeyBindForCommand(client, "fish")) { if (doesPlayerHaveKeyBindForCommand(client, "fish")) {
messageText = getLocaleString(client, "FishingCastKeyPressHelp") messageText = getLocaleString(client, "FishingCastKeyPressHelp");
} }
showGameMessage(client, messageText); showGameMessage(client, messageText);
getPlayerData(client).fishingLineState = AGRP_FISHING_LINE_STATE_NONE;
getPlayerData(client).fishingLineCastStart = 0;
} }
// =========================================================================== // ===========================================================================
@@ -119,4 +127,16 @@ function isPlayerInFishingSpot(client) {
return false; 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);
}
// =========================================================================== // ===========================================================================