I have modified job system to call the event jobssystem:Name but when jobssystem:Name is calling i don’t do anything …
My client code :
---------------- By applemaniac with job system and VDK inventory ! ------------------------
local ShowBlips = true
local CanFishing = false
local Pecheur = {
{name="Entreprise", colour=3, id=40, x=-893.473, y=-1323.39, z=5.00018},
{name="Poissons", colour= 3, id=68, x=-2508.77, y=-1349.01, z=5, luke=15},
{name="Poissons", colour= 3, id=68, x=-177.858, y=-3047.97, z=5, luke=5},
{name="Poissons", colour= 3, id=68, x=652.39, y=7604.34, z=5, luke=4},
{name="Happy Shark", colour= 3, id=80, x=-146.836, y=-1423.15, z=30.8563},
}
if true then
for _, item in pairs(Pecheur) do
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, item.id)
SetBlipAsShortRange(item.blip, true)
SetBlipColour(item.blip, item.colour)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(item.name)
EndTextCommandSetBlipName(item.blip)
end
end
RegisterNetEvent('jobssystem:Name')
AddEventHandler('jobssystem:Name', function(nameJob)
if nameJob == 'Pecheur' then
CanFishing = true
else
CanFishing = false
end
end)
function drawTxt(text,font,centre,x,y,scale,r,g,b,a)
SetTextFont(font)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextCentre(centre)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x , y)
end
function DisplayHelpText(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
local ShowMsgtime = { msg = "", time = 0 }
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if ShowMsgtime.time ~= 0 then
drawTxt(ShowMsgtime.msg, 0, 1, 0.5, 0.8, 0.6, 255, 255, 255, 255)
ShowMsgtime.time = ShowMsgtime.time - 1
end
end
end)
Citizen.CreateThread(function()
if CanFishing == true then
DrawMarker(1,Pecheur[2].x, Pecheur[2].y,Pecheur[2].z,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
DrawMarker(1,Pecheur[3].x, Pecheur[3].y,Pecheur[3].z,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
DrawMarker(1,Pecheur[4].x, Pecheur[4].y,Pecheur[4].z,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
while true do
Citizen.Wait(0)
if IsNear(Pecheur[2]) == true then
drawTxt('Appuyes sur ~r~ E ~w~ pour pêcher !',0,1,0.5,0.8,0.6,255,255,255,255)
if IsControlJustReleased(1, 38) then
ShowMsgtime.msg = 'Pêche en cours ...'
ShowMsgtime.time = 250
Citizen.Wait(math.random(3000, 10000))
chance = math.random(0, Pecheur[2].luke)
if chance == 7 then
TriggerEvent('player:receiveItem', 28, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Calamar~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Calamar~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance <= 4 then
TriggerEvent('player:receiveItem', 29, 1)
ShowMsgtime.msg = 'Tu as pêché une ~r~Dorade~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché une ~r~Dorade~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 5 then
TriggerEvent('player:receiveItem', 30, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Merlan~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Merlan~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 6 then
TriggerEvent('player:receiveItem', 31, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Thon~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Thon~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance >= 8 then
ShowMsgtime.msg = '~r~Rien~w~ ne mord !'
end
end
elseif IsNear(Pecheur[3]) == true then
drawTxt('Appuyes sur ~r~ E ~w~ pour pêcher !',0,1,0.5,0.8,0.6,255,255,255,255)
if IsControlJustReleased(1, 38) then
ShowMsgtime.msg = 'Pêche en cours ...'
ShowMsgtime.time = 250
--drawTxt('Pêche en cours ...',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(math.random(3000, 10000))
chance = math.random(0, Pecheur[3].luke)
if chance == -8 then
TriggerEvent('player:receiveItem', 28, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Calamar~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Calamar~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 5 then
TriggerEvent('player:receiveItem', 29, 1)
ShowMsgtime.msg = 'Tu as pêché une ~r~Dorade~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché une ~r~Dorade~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 4 then
TriggerEvent('player:receiveItem', 30, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Merlan~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Merlan~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance <= 3 then
TriggerEvent('player:receiveItem', 31, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Thon~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Thon~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
end
end
elseif IsNear(Pecheur[4]) == true then
drawTxt('Appuyes sur ~r~ E ~w~ pour pêcher !',0,1,0.5,0.8,0.6,255,255,255,255)
if IsControlJustReleased(1, 38) then
ShowMsgtime.msg = 'Pêche en cours ...'
ShowMsgtime.time = 250
--drawTxt('Pêche en cours ...',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(math.random(3000, 10000))
chance = math.random(0, Pecheur[4].luke)
if chance <= 2 then
TriggerEvent('player:receiveItem', 28, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Calamar~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Calamar~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 3 then
TriggerEvent('player:receiveItem', 29, 1)
ShowMsgtime.msg = 'Tu as pêché une ~r~Dorade~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché une ~r~Dorade~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 4 then
TriggerEvent('player:receiveItem', 30, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Merlan~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Merlan~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
elseif chance == 5 then
TriggerEvent('player:receiveItem', 31, 1)
ShowMsgtime.msg = 'Tu as pêché un ~r~Thon~w~ !'
ShowMsgtime.time = 150
--drawTxt('Tu as pêché un ~r~Thon~w~ !',0,1,0.5,0.8,0.6,255,255,255,255)
Citizen.Wait(3500)
end
end
end
end
end
end)
function IsNear(Blips)
local ply = GetPlayerPed(-1)
local plyCoords = GetEntityCoords(ply, 0)
local distance = GetDistanceBetweenCoords(Blips.x, Blips.y, Blips.z, plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
if(distance <= 10) then
return true
end
end
Citizen.CreateThread(function()
if CanFishing == true then
DrawMarker(1,Pecheur[5].x, Pecheur[5].y,Pecheur[5].z,0,0,0,0,0,0,2.001,2.0001,0.5001,0,155,255,200,0,0,0,0)
while true do
Citizen.Wait(0)
if (IsNear(Pecheur[5]) == true) then
DisplayHelpText('Appuyer sur ~r~E~w~ pour vendre vos poissons !')
if (IsControlJustPressed(1, 38)) then
ShowMsgtime.msg = '~g~Vente~w~ de vos ~r~poissons~w~ en cours ...'
ShowMsgtime.time = 250
TriggerEvent('player:sellItem', 28, 85) -- Calamar
TriggerEvent('player:sellItem', 29, 45) -- Dorade
TriggerEvent('player:sellItem', 30, 50) -- Merlan
TriggerEvent('player:sellItem', 31, 25) -- Thon
end
end
end
end
end)
Can you help me pls ?