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

Wysłany: 2017-10-08, 19:55


xWilczu







Wiek: 24
Na forum: 3967 dni
Posty: 25
Nick w MP: Svatekl



Respekt: 50

Otrzymuj? 2x wi?cej pieni?dzy z pracy, nie mam poj?cia dla czego.

Kod:

function busDriver(el, md)
if el ~= localPlayer or not md then return end
if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end

if jobTarget == #districtsBus then
finishJob()
playSoundFrontEnd(5)
outputChatBox("* Zako?czy?e?/a? prac?.")
else
local kasa = math.random(5,5)
showMarker()
playSoundFrontEnd(12)
if getElementData(localPlayer,"player:premium") then
local kasa = math.random(5,5)
triggerServerEvent("givePlayerMoney", localPlayer, kasa)
outputChatBox("Otrzymujesz "..kasa.." PLN za dojechanie do punktu.")
else
triggerServerEvent("givePlayerMoney", localPlayer, kasa)
outputChatBox("Otrzymujesz "..kasa.." PLN za dojechanie do punktu.")
end
end
end


S? dwa tiggerServerEvent'y dlatego, ?e jedno jest pod zwyk?ego gracza a drugie pod premium. Wcze?niej by?o wszystko normalnie. Zrobi?em serverside givePlayerMoney dlatego, ?e w innej pracy nie dostawa?em pieni?dzy... A teraz jak usun??em ten serverside to normalnie dostaj? pieni?dze z tej innej pracy. Tak jakby ten kod by? gdzie? ukryty, mo?na go jako? usun??? Nie mam ju? go w ?adnym skrypcie, pomocy![/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-08, 19:56


Kuksss

guwno






Wiek: 22
Na forum: 3781 dni
Posty: 102
Nick w MP: guwnp

Piwa: 732

Respekt: 70,5

Ostrzeżeń: 100%
local kasa = math.random(5,5)
zamie? na
local kasa = 5

Podpis
c***
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-08, 19:58


xWilczu







Wiek: 24
Na forum: 3967 dni
Posty: 25
Nick w MP: Svatekl



Respekt: 50

Robi?em te? osobne skrypty z removeEventHandler i z addEventHandler z dopiskiem false. Te? nic nie pomog?o...

[ Dodano: 2017-10-08, 19:59 ]
"Kuksss" napisał/a:

local kasa = math.random(5,5)
zamie? na
local kasa = 5


To nic nie pomaga dlatego, ?e (5,5) to jest przedzia? losowej liczby. Np. (5,10) to dostan? 5-10$ za jeden punkt.

[ Dodano: 2017-10-08, 20:01 ]
Kuksss i jeszcze jak usun??em to math.random i w to miejsce wpisa?em 5 to dalej jest to samo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-08, 20:01


Kuksss

guwno






Wiek: 22
Na forum: 3781 dni
Posty: 102
Nick w MP: guwnp

Piwa: 732

Respekt: 70,5

Ostrzeżeń: 100%
xWilczu, Nie masz przypadkiem
triggerServerEvent("givePlayerMoney"localPlayerkasa*2)

??

Podpis
c***
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-08, 20:04


xWilczu







Wiek: 24
Na forum: 3967 dni
Posty: 25
Nick w MP: Svatekl



Respekt: 50

Og?lnie ju? nigdzie nie mam addEventHandler givePlayerMoney a u?ywa tej funkcji... Pom??cie, mo?e ona si? zapisuje gdzie?? Restart serwera te? nic nie pomaga...

[ Dodano: 2017-10-08, 20:04 ]
"Kuksss" napisał/a:

xWilczu, Nie masz przypadkiem
triggerServerEvent("givePlayerMoney"localPlayerkasa*2)

??


NIE MAM :(

[ Dodano: 2017-10-08, 20:07 ]
Wgra?em nawet t? prac? pierwotnie tak? jak na pocz?tku wi?c nie ma w niej ?adnego problemu raczej a dalej dostaje 2x... :/

[ Dodano: 2017-10-08, 20:09 ]
W innych pracach te? teraz tak mam... Ju? nie wiem o co chodzi a Event givePlayerMoney po stronie serwera ju? nawet nie mam...

[ Dodano: 2017-10-08, 20:09 ]
Debug czy?ciutki

[ Dodano: 2017-10-08, 20:12 ]
I jak nie mam tego eventu po serverside givePlayerMoney to powinno by? w debugu "Client (nick) triggered...". A tego nie ma eh. Czy mog? ten eventhandler sam si? gdzie? zaszy??

[ Dodano: 2017-10-08, 20:18 ]
CZY KT?RY? Z TYCH KOD?W USUNIE MI UKRYTE EVENTHANDLERY?

Kod:

function drawText() -- A function to draw the text we want
dxDrawText(text, 10,100) -- creates a dx text 10 pixels from left, 100 from top of the screen
end
function doText(command, ...)
if command == "starttext" then -- if player wrote /starttext
text = table.concat({...}," ") -- then we retrieve the text
addEventHandler("onClientRender", getRootElement(), drawText) -- and since addEventHandler and removeEventHandler's syntax is the same, we just define the function we use later
elseif command == "stoptext" then
removeEventHandler("onClientRender", getRootElement(), drawText) -- this time we use removeEventHandler
end


Kod:

local EventNHandlers = { }
local _functions = { }

_addEventHandler = addEventHandler
addEventHandler = function (eventName, attachedTo, handlerFunction)
if handlerFunction then
if event == "onClientPreRender" then
setTimer(
function()
handlerFunction()
end,2000,1)
elseif event == "onClientRender" then
setTimer(
function()
handlerFunction()
end,2000,1)
elseif event == "onClientHUDRender" then
setTimer(
function()
handlerFunction()
end,2000,1)
else
if _addEventHandler(eventName, attachedTo, handlerFunction) then
EventNHandlers[#EventNHandlers+1] = {eventName, attachedTo, handlerFunction}
end
end
if not _functions[handlerFunction] then
_functions[handlerFunction] = true -- set it to nil when you want to remove the event handler
end
end

end

[ Dodano: 2017-10-09, 17:31 ]
Eh chyba nikt mi nie pomo?e ;(

Postaw piwo autorowi tego posta
 

 
Tagi: więcej :: pieniędzy :: pracy.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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