Well it’s important to clarify that my English is not very good so I will try to explain myself in the best way
I have a function that gives 3 results according to the probability of dropping an item. What I do not want to do is call 3 serverevent to give those items. And I would not be coming out doing it optimal
Cient
function dropitem ()
possibility = math.random(1, 100)
if (possibility > 10) and (possibility < 90) then
dropcplata = math.random(5, 25)
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"find iron : "..dropcplata.."")
--TriggerServerEvent("give:item", iron)
else
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"you did not find silver ")
end
Wait(2500)
possibility = math.random(1, 100)
if (possibility > 30) and (possibility < 80) then
dropbgold = math.random(3, 10)
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"find gold : "..dropbgold.."")
--TriggerServerEvent("give:item", gold)
else
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"you did not find silver")
end
Wait(2500)
possibility = math.random(1, 100)
if (possibility > 40) and (possibility < 55) then
dropdiamon = math.random(1, 3)
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"find diamon : "..dropdiamon.."")
--TriggerServerEvent("give:item", diamon)
else
TriggerEvent('chatMessage', 'SYSTEM', {255, 0, 0},"you did not find silver")
end
end
I could really call an event for everyone, but I would like to know how to do it best.
That’s why I do not put the serv.lua
thank you very much: D