Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-04-16, 23:55


Erczi







Wiek: 27
Na forum: 2371 dni
Posty: 17
Nick w MP: ewwe

Piwa: 4

Respekt: 50

Chce zeby za napad dostawalo sie randomow? kase np. od 15000 do 50000

Kod:

local sx,sy = guiGetScreenSize()
local sc = 1920/sx

local font = dxCreateFont("f.ttf", 17)

local celuje = nil

local czas = 5

local ped = createPed(46, -2076.93,-2430.00,30.63)
setElementRotation(ped, 0, 0, 230)
setElementData(ped, "napad:stacja", true)

local blip = createBlip(-2072.95,-2433.10,30.63, 17)
setBlipVisibleDistance(blip, 250)

function isPedAiming ( thePedToCheck )
if isElement(thePedToCheck) then
if getElementType(thePedToCheck) == "player" or getElementType(thePedToCheck) == "ped" then
if getPedTask(thePedToCheck, "secondary", 0) == "TASK_SIMPLE_USE_GUN" then
return true
end
end
end
return false
end

addEventHandler("onClientPlayerTarget", root, function(el)
if isPedAiming(localPlayer) and el then
if getElementType(el) == "ped" and getElementData(el, "napad:stacja") and not celuje then
if getElementData(el, "napad:okradziony") then exports['yd-noti']:noti("To miejsce zosta?o niedawno okradzione!", "error") return end
if getElementData(el, "napad:okradany") then exports['yd-noti']:noti("Aktualnie kto? jest w trakcie napadu tego miejsca!", "error") return end
toggleControl("fire", false)
celuje = true
setElementData(el, "napad:okradany", true)
setElementData(localPlayer, "player:napad", true)
aktywujnapad()
end
end
end)

function gui()
dxDrawText("Do ko?ca napadu:\n"..czas.." sekund", 10+1/sc, 1022+1/sc, 263+1/sc, 1080+1/sc, tocolor(0,0,0), 1/sc, font, "left", "center")
dxDrawText("Do ko?ca napadu:\n#3366ff"..czas.." sekund", 10/sc, 1022/sc, 263/sc, 1080/sc, tocolor(200,200,200), 1/sc, font, "left", "center", false, false, false, true)
end

function aktywujnapad()
setPedAnimation(ped, "ped", "handsup", -1, false, false)
exports['yd-noti']:noti("Rozpocz?to napad, policja zosta?a poinformowana o zaistnia?ej sytuacji!\nUdaj si? do sejfu.", "success")
triggerServerEvent("napad:wezwij", localPlayer)
sejf = createMarker(-2077.80,-2430.49,30.63-1, "cylinder", 1, 150, 0, 0)
addEventHandler("onClientMarkerHit", sejf, okradanie)
end

function okradanie()
if not getElementData(localPlayer, "player:napad") then return end
if getElementData(localPlayer, "player:okradanie") then return end
setElementData(localPlayer, "player:okradanie", true)
triggerServerEvent("napad:animka", localPlayer, true)
addEventHandler("onClientRender", root, gui)
timer = setTimer(function()
if czas == 0 then
zakoncznapad()
killTimer(timer)
end
czas = czas-1
end, 1000, 0)
end

function zakoncznapad()
destroyElement(sejf)
triggerServerEvent("napad:animka", localPlayer)
setElementData(localPlayer, "player:okradanie", nil)
setElementData(ped, "napad:okrdziony", true)
setElementData(ped, "napad:okradany", nil)
setPedAnimation(ped)
removeEventHandler("onClientRender", root, gui)
czas = 5
exports['yd-noti']:noti("Pomy?lnie zako?czono napad.", "success")
setTimer(function()
setElementData(ped, "napad:okradziony", nil)
end, 10, 1)
end
[/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-04-17, 09:46


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Kod:

local sx,sy = guiGetScreenSize()
local sc = 1920/sx

local font = dxCreateFont("f.ttf", 17)

local celuje = nil

local czas = 5

local ped = createPed(46, -2076.93,-2430.00,30.63)
setElementRotation(ped, 0, 0, 230)
setElementData(ped, "napad:stacja", true)

local blip = createBlip(-2072.95,-2433.10,30.63, 17)
setBlipVisibleDistance(blip, 250)

function isPedAiming ( thePedToCheck )
if isElement(thePedToCheck) then
if getElementType(thePedToCheck) == "player" or getElementType(thePedToCheck) == "ped" then
if getPedTask(thePedToCheck, "secondary", 0) == "TASK_SIMPLE_USE_GUN" then
return true
end
end
end
return false
end

addEventHandler("onClientPlayerTarget", root, function(el)
if isPedAiming(localPlayer) and el then
if getElementType(el) == "ped" and getElementData(el, "napad:stacja") and not celuje then
if getElementData(el, "napad:okradziony") then exports['yd-noti']:noti("To miejsce zosta?o niedawno okradzione!", "error") return end
if getElementData(el, "napad:okradany") then exports['yd-noti']:noti("Aktualnie kto? jest w trakcie napadu tego miejsca!", "error") return end
toggleControl("fire", false)
celuje = true
setElementData(el, "napad:okradany", true)
setElementData(localPlayer, "player:napad", true)
aktywujnapad()
end
end
end)

function gui()
dxDrawText("Do ko?ca napadu:\n"..czas.." sekund", 10+1/sc, 1022+1/sc, 263+1/sc, 1080+1/sc, tocolor(0,0,0), 1/sc, font, "left", "center")
dxDrawText("Do ko?ca napadu:\n#3366ff"..czas.." sekund", 10/sc, 1022/sc, 263/sc, 1080/sc, tocolor(200,200,200), 1/sc, font, "left", "center", false, false, false, true)
end

function aktywujnapad()
setPedAnimation(ped, "ped", "handsup", -1, false, false)
exports['yd-noti']:noti("Rozpocz?to napad, policja zosta?a poinformowana o zaistnia?ej sytuacji!\nUdaj si? do sejfu.", "success")
triggerServerEvent("napad:wezwij", localPlayer)
sejf = createMarker(-2077.80,-2430.49,30.63-1, "cylinder", 1, 150, 0, 0)
addEventHandler("onClientMarkerHit", sejf, okradanie)
end

function okradanie()
if not getElementData(localPlayer, "player:napad") then return end
if getElementData(localPlayer, "player:okradanie") then return end
setElementData(localPlayer, "player:okradanie", true)
triggerServerEvent("napad:animka", localPlayer, true)
addEventHandler("onClientRender", root, gui)
timer = setTimer(function()
if czas == 0 then
zakoncznapad()
killTimer(timer)
end
czas = czas-1
end, 1000, 0)
end

function zakoncznapad()
destroyElement(sejf)
triggerServerEvent("napad:animka", localPlayer)
setElementData(localPlayer, "player:okradanie", nil)
setElementData(ped, "napad:okrdziony", true)
setElementData(ped, "napad:okradany", nil)
setPedAnimation(ped)
removeEventHandler("onClientRender", root, gui)
czas = 5
exports['yd-noti']:noti("Pomy?lnie zako?czono napad.", "success")
givePlayerMoney(math.random(15000,50000))
setTimer(function()
setElementData(ped, "napad:okradziony", nil)
end, 10, 1)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-04-17, 11:38


vAnimo

Zielony w luła






Wiek: 19
Na forum: 2312 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 882

Respekt: 70

U?ywasz do tego

Więcej informacji znajdziesz w Wikipedii MTA:

math.random

Kod:

local kasa = math.random(1,5000) -- losuje ci liczbe od 1 do 5000

i


Więcej informacji znajdziesz w Wikipedii MTA:

givePlayerMoney

Kod:

givePlayerMoney(gracz,kasa)


Postaw piwo autorowi tego posta
 

 
Tagi: dostawanie :: kasy :: napad
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Dostawanie Kasy Za Napad Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku