Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --> Created by n0pe
- local hanfPrice = tonumber(math.random(10, 30))
- local weedPrice = tonumber(math.random(1, 50))
- local matsPrice = tonumber(math.random(1, 50))
- local hanfPed = createPed(200, -2579.93213, 310.14310, 5.17969)
- local hanfSphere = createColSphere(-2579.93213, 310.14310, 5.17969, 3)
- setElementRotation(hanfPed, 0, 0, 90)
- setElementData(hanfPed, "allowedDamage", true)
- local weedPed = createPed(29, -2311.59790, 1068.02820, 65.58594)
- local weedSphere = createColSphere(-2311.59790, 1068.02820, 65.58594, 3)
- setElementRotation(weedPed, 0, 0, 90)
- setElementData(weedPed, "allowedDamage", true)
- local matsPed = createPed(29, -2311.59790, 1066.02820, 65.58594)
- local matsSphere = createColSphere(-2311.59790, 1066.02820, 65.58594, 3)
- setElementRotation(matsPed, 0, 0, 90)
- setElementData(matsPed, "allowedDamage", true)
- addEventHandler("onColShapeHit", hanfSphere, function(uElement, iDimension)
- if getElementType(uElement) == "player" and iDimension then
- outputChatBox("Hey du,hier kannst du Hanfsamen Kaufen.", uElement, 255, 255, 0)
- end
- end)
- addEventHandler("onColShapeHit", weedSphere, function(uElement, iDimension)
- if getElementType(uElement) == "player" and iDimension then
- outputChatBox("Hey du, hier kannst du Weed verkaufen.", uElement, 255, 255, 0)
- end
- end)
- addEventHandler("onColShapeHit", matsSphere, function(uElement, iDimension)
- if getElementType(uElement) == "player" and iDimension then
- outputChatBox("Hey du, hier kannst du Mats verkaufen.", uElement, 255, 255, 0)
- end
- end)
- addEventHandler("onPlayerClick", getRootElement(), function(btn, state, clickedElement)
- if btn == "left" and state == "down" and not getElementClicked(source) then
- if clickedElement then
- if clickedElement == hanfPed then
- triggerClientEvent(source, "onBuyHanf", getRootElement(), hanfPrice)
- setElementClicked(source, true)
- elseif clickedElement == weedPed then
- triggerClientEvent(source, "onSellWeed", getRootElement(), weedPrice)
- setElementClicked(source, true)
- elseif clickedElement == matsPed then
- triggerClientEvent(source, "onSellMats", getRootElement(), matsPrice)
- setElementClicked(source, true)
- end
- end
- end
- end)
- addEvent("sellDrugstoNPC", true)
- addEventHandler("sellDrugstoNPC", root, function(amount)
- if amount then
- if (vioGetElementData(client, "drugs") >= amount) then
- vioSetElementData(client, "drugs", vioGetElementData(client, "drugs") - amount)
- vioSetElementData(client, "money", vioGetElementData(client, "money") + (amount * weedPrice))
- outputChatBox("Drogendealer: Danke für " .. amount .. " Gramm.", client, 255, 255, 255, false)
- outputChatBox("Drogendealer: Komm gerne wieder wenn du mehr hast.", client, 255, 255, 255, false)
- triggerClientEvent(client, "closeDrugSellWindow", client)
- else
- outputChatBox("Du hast nicht genug Drogen dabei.", client, 255, 0, 0, false)
- end
- end
- end)
- addEvent("sellMatstoNPC", true)
- addEventHandler("sellMatstoNPC", root, function(amount)
- if amount then
- if (vioGetElementData(client, "mats") >= amount) then
- vioSetElementData(client, "mats", vioGetElementData(client, "mats") - amount)
- vioSetElementData(client, "money", vioGetElementData(client, "money") + (amount * matsPrice))
- outputChatBox("Matsdealer: Danke für " .. amount .. " Materialen.", client, 255, 255, 255, false)
- outputChatBox("Matsdealer: Komm gerne wieder wenn du mehr hast.", client, 255, 255, 255, false)
- triggerClientEvent(client, "closeMatsSellWindow", client)
- else
- outputChatBox("Du hast nicht genug Materialien dabei.", client, 255, 0, 0, false)
- end
- end
- end)
- addEvent("buyHanfFromNPC", true)
- addEventHandler("buyHanfFromNPC", root, function(amount)
- if amount then
- if (vioGetElementData(client, "money") >= amount * hanfPrice) then
- vioSetElementData(client, "money", vioGetElementData(client, "money") - amount * hanfPrice)
- vioSetElementData(client, "flowerseeds", vioGetElementData(client, "flowerseeds") + amount)
- outputChatBox("Samenhändler: Hier hast du die Samen.", client, 255, 255, 255, false)
- outputChatBox("Samenhändler: Komm gerne wieder wenn du mehr brauchst.", client, 255, 255, 255, false)
- triggerClientEvent(client, "closeHanfBuyWindow", client)
- else
- outputChatBox("Du hast nicht genug Geld dabei.", client, 255, 0, 0, false)
- end
- end
- end)
- local function changePrices()
- hanfPrice = tonumber(math.random(10, 30))
- weedPrice = tonumber(math.random(1, 50))
- matsPrice = tonumber(math.random(1, 50))
- end
- setTimer(changePrices, 1000 * 60 * 30, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement