Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #21

Merged
merged 5 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions client/boosting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ local function UpdateBlips()
DelayDelivery()
end)
end
end
end

local AntiSpam = false -- Just a true / false boolean to not spam the shit out of the server.
local carCoords = nil
-- sends information from server to client that we found the car and we started lockpicking
RegisterNetEvent('lockpicks:UseLockpick', function()
if AntiSpam then return end
if AntiSpam then return end
if NetID and DoesEntityExist(NetworkGetEntityFromNetworkId(NetID)) then
local carSpawned = NetworkGetEntityFromNetworkId(NetID)
local dist = #(GetEntityCoords(carSpawned) - GetEntityCoords(PlayerPedId()))
Expand All @@ -95,12 +95,20 @@ end)
-- MISSION STARTER --

-- Sends information from server to client that it will start now
RegisterNetEvent('jl-laptop:client:MissionStarted', function(netID, coords) -- Pretty much just resets every boolean to make sure no issues will occour.

RegisterNetEvent('jl-laptop:client:MissionStarted', function(netID, coords, plate) -- Pretty much just resets every boolean to make sure no issues will occour.
NetID = netID
carCoords = coords
AntiSpam = false
inZone = false

-- send plate number
SendNUIMessage({
action = "boosting/horseboosting",
data = {
plate = plate or "Unknown?"
}
})
--print(coords)

if PZone then PZone:destroy() PZone = nil end
Expand Down Expand Up @@ -241,6 +249,10 @@ RegisterNetEvent('jl-laptop:client:ReturnCar', function(coords)
SetBlipFlashTimer(dropoffBlip, 5000)
end)

RegisterNetEvent("jl-laptop:client:ToVinScratch", function (coords)

end)

-- Just a netevent that retracts all the booleans and properly resets the client --
RegisterNetEvent('jl-laptop:client:finishContract', function(table)
if PZone then PZone:destroy() PZone = nil end
Expand Down
3 changes: 3 additions & 0 deletions db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE player_vehicles ADD COLUMN `vinnumber` VARCHAR(50) NULL;

ALTER TABLE player_vehicles ADD COLUMN `vinscratch` INT(2) DEFAULT 0;
2 changes: 1 addition & 1 deletion html/assets/index.css

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions html/js/index.js

Large diffs are not rendered by default.

37 changes: 0 additions & 37 deletions server/bennys.lua

This file was deleted.

4 changes: 2 additions & 2 deletions server/boosting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RegisterNetEvent('jl-laptop:server:FinalDestination', function()
TriggerClientEvent('jl-laptop:client:ReturnCar', src, place)
ResetAnotherShit(id)
elseif currentRuns[CID] and not currentRuns[CID].dropOff and currentRuns[CID].type == "vinscratch" then

--NOT YET DONE
end
end)

Expand Down Expand Up @@ -138,7 +138,7 @@ local function SpawnCar(src)


TriggerClientEvent('jl-laptop:client:SyncPlates', -1, ActivePlates)
TriggerClientEvent('jl-laptop:client:MissionStarted', src, currentRuns[CID].NetID, coords)
TriggerClientEvent('jl-laptop:client:MissionStarted', src, currentRuns[CID].NetID, coords, plate)

return true
else
Expand Down
4 changes: 4 additions & 0 deletions svelte-source/src/@types/boosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export interface IContracts {
cost: number;
}

export interface IStartedContract extends IContracts {
plate?: string;
}

export interface ISaledContract extends IContracts {
price: number;
}
19 changes: 16 additions & 3 deletions svelte-source/src/components/apps/Boosting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { quadInOut } from "svelte/easing";
import { DumyBoostingData } from "@utils/initDumyData";
import { onMount } from "svelte";
import { debugData } from "@utils/debugData";

let tierRing = {
D: "rgb(77, 141, 77)",
Expand Down Expand Up @@ -169,6 +170,10 @@
});
}

function Truncate(text: string) {
return text.length > 20 ? text.slice(0, 19) + "..." : text;
}

function CancelContract(id: number) {
modals.show({
show: true,
Expand All @@ -188,6 +193,7 @@
"Are you sure you want to cancel this contract?, you will loose it...",
});
}

onMount(() => {
DumyBoostingData();
});
Expand Down Expand Up @@ -250,13 +256,20 @@
{$startedContracts.contract}
</div>
<div class="boost-name">{$startedContracts.owner}</div>
<div class="boost-car">{$startedContracts.carName}</div>

<div class="boost-car">
{Truncate($startedContracts.carName)}
</div>
<div class="plate">
Plate: <b style="color: gold;"
>{$startedContracts.plate ?? "Ask JL"}</b
>
</div>
<div class="expires">
Expires: <b
>{moment($startedContracts.expire).endOf("hour").fromNow()}</b
>
</div>

<div class="button started">
<button on:click={() => CancelContract($startedContracts.id)}
>Cancel Contract</button
Expand All @@ -283,7 +296,7 @@
{contract.contract}
</div>
<div class="boost-name">{contract.owner}</div>
<div class="boost-car">{contract.carName}</div>
<div class="boost-car">{Truncate(contract.carName)}</div>
<div class="boost-reward">Buy In: <b>{contract.cost} GNE</b></div>
<div class="expires">
Expires: <b>{moment(contract.expire).endOf("hour").fromNow()}</b>
Expand Down
21 changes: 7 additions & 14 deletions svelte-source/src/store/boosting.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import { writable } from "svelte/store";
import type { IContracts, ISaledContract } from "../@types/boosting";
import type {
IContracts,
ISaledContract,
IStartedContract,
} from "../@types/boosting";

export const contracts = writable<IContracts[]>([]);
export const startedContracts = writable<IContracts>(null);
export const startedContracts = writable<IStartedContract>(null);

let contractsStore: IContracts[];
let startedContractStore: IContracts;

const unsubsContracts = contracts.subscribe((v) => {
contractsStore = v;
});

const unsubscribeContractStart = startedContracts.subscribe((v) => {
startedContractStore = v;
});

export function handleContracts(data: IContracts[]) {
export function handleContracts(data: IStartedContract[]) {
contracts.set(data);
}

Expand Down
6 changes: 6 additions & 0 deletions svelte-source/src/utils/eventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export function handlerMessage() {
startedContracts.set(null);
notifications.send("You have completed the contact", "boosting", 5000);
break;
case "boosting/horseboosting":
startedContracts.update((segs) => {
segs.plate = event.data?.data.plate;
return segs;
});
break;
}
}
onMount(() => window.addEventListener("message", Event));
Expand Down