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

Wysłany: 2017-04-22, 16:46


saller123

Dopiero się ucze ;)






Wiek: 25
Na forum: 4680 dni
Posty: 95
Nick w MP: Davitek

Piwa: 212

Respekt: 70

Witam, powiedzia?by mi kto? co jest nie tak w tym skrypcie?


Skrypt:
local alpha
local suma

local hajs

function DodajKase(plrilosc)

    hajs  getElementData(plr"player:money")
    suma hajs+ilosc
    setElementData(plr"player:money"suma)
    alpha 255
    alert()
end

function alert()
    setTimer(
    function()
    alpha 0
    end3000)
end
function tekst()
local screenWscreenH guiGetScreenSize()
dxDrawText("+ %00f" ..suma, (screenW 0.7801) - 1, (screenH 0.2865) - 1, (screenW 0.9926) - 1, (screenH 0.3333) - 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) + 1, (screenH 0.2865) - 1, (screenW 0.9926) + 1, (screenH 0.3333) - 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) - 1, (screenH 0.2865) + 1, (screenW 0.9926) - 1, (screenH 0.3333) + 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) + 1, (screenH 0.2865) + 1, (screenW 0.9926) + 1, (screenH 0.3333) + 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..sumascreenW 0.7801screenH 0.2865screenW 0.9926screenH 0.3333tocolor(7300alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
end
addEventHandler "onClientRender"roottekst )

function consoleCreateMarker playerSourcecommandName )
DodajKase(playerSource497.78)
end
addCommandHandler "hajsik"consoleCreateMarker )



DB3:
Kod:

ERROR: [SKRYPTY]/hl_Waluta/script.lua:19: attempt to perform arithmetic on local 'hajs' (a boolean value)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-22, 17:42


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466


function DodajKase(plrilosc)

    hajs  getElementData(plr"player:money")
    suma tonumber(hajs)+ilosc
    setElementData(plr"player:money"suma)
    alpha 255
    alert()
end

function alert()
    setTimer(
    function()
    alpha 0
    end3000)
end
function tekst()
local screenWscreenH guiGetScreenSize()
dxDrawText("+ %00f" ..suma, (screenW 0.7801) - 1, (screenH 0.2865) - 1, (screenW 0.9926) - 1, (screenH 0.3333) - 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) + 1, (screenH 0.2865) - 1, (screenW 0.9926) + 1, (screenH 0.3333) - 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) - 1, (screenH 0.2865) + 1, (screenW 0.9926) - 1, (screenH 0.3333) + 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..suma, (screenW 0.7801) + 1, (screenH 0.2865) + 1, (screenW 0.9926) + 1, (screenH 0.3333) + 1tocolor(000alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
dxDrawText("+ %00f" ..sumascreenW 0.7801screenH 0.2865screenW 0.9926screenH 0.3333tocolor(7300alpha), 1.50"pricedown""right""center"falsefalsefalsefalsefalse)
end
addEventHandler "onClientRender"roottekst )

function consoleCreateMarker playerSourcecommandName )
DodajKase(playerSource497.78)
end
addCommandHandler "hajsik"consoleCreateMarker )


Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-22, 17:45


saller123

Dopiero się ucze ;)






Wiek: 25
Na forum: 4680 dni
Posty: 95
Nick w MP: Davitek

Piwa: 212

Respekt: 70

ERROR: [SKRYPTY]/hl_Waluta/script.lua:14: attempt to perform arithmetic on a nil value

Chodzi o to:
suma tonumber(hajs)+ilosc


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-22, 18:07


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466


function DodajKase(plrilosc)
ilosc tonumber(ilosc)
    hajs  getElementData(plr"player:money")
    suma tonumber(hajs)+ilosc
    setElementData(plr"player:money"suma)
    alpha 255
    alert()
end

jezeli nie zadziala to usun tonumber przed hajs

Ostatnio zmieniony przez amited 2017-04-22, 18:12, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-22, 18:11


saller123

Dopiero się ucze ;)






Wiek: 25
Na forum: 4680 dni
Posty: 95
Nick w MP: Davitek

Piwa: 212

Respekt: 70

Okej, wystarczy?o faktycznie zrobi? tak:
suma tonumber(hajs)+tonumber(ilosc)


Lecz nie wy?wietla na ekranie dxdrawtext :/

Podpis
Jeżeli ci pomogłem, postaw piwerko :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-22, 18:14


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

bo suma ma by? w funkcji kt?ra j? wy?wietla

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: zmienna
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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