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

Wysłany: 2015-07-06, 12:13


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Mam taki problem. Zrobi?em skrypt na temperatur? cia?a, wszystko git, ale gdy zrobi?em zapis tej temperatury to wog?le si? nie pokazuje dxDrawText.

P.S. Gdy robi?em to na setElementDatach itp. to si? pojawia? text lecz nie zapisywa? si?.

local xguiGetScreenSize()
local nar getTickCount()

function narastanie()
if getTickCount()-nar 6000 then
nar getTickCount()
local konto getPlayerAccount(localPlayer)
local temp getAccountData(konto"temperatura") or 0
temp1 temp 0.1
setAccountData(konto"temperatura"temp1)
end
end
addEventHandler("onClientRender"rootnarastanie)

function wyswietl()
local konto getPlayerAccount(localPlayer)
local temperatura getAccountData(konto"temperatura")
local temper1 string.format("%.02f"temperaturadxDrawText("Temperatura: "..temper1.." ?C "x/1.80y/6.51209835tocolor(25500255), 1.00"pricedown""left""top"falsefalsefalsefalsefalse)  
end
addEventHandler("onClientRender"rootwyswietl)

function zapisz()
local konto getPlayerAccount(localPlayer)
local stan getAccountData(konto"temperatura")
end
addEventHandler("onClientPlayerQuit"rootzapisz)

function wczytaj()
if getAccountData(konto"temperatura"then
setAccountData(konto"temperatura"stan)
else
setAccountData(konto"temperatura"36.6)
end
end
addEventHandler("onPlayerLogin"rootwczytaj)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 12:17


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

accountdata dzia?a tylko po stronie s-side

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 12:47


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Shuffle, a jak zrobi? na elementdat? te? nie dzia?a.

local x, y = guiGetScreenSize()
local nar = getTickCount()

function narastanie()
if getTickCount()-nar 6000 then
nar getTickCount()
local temp getElementData(localPlayer"temperatura") or 0
temp1 temp 0.1
setElementData(localPlayer"temperatura"temp1)
end
end
addEventHandler("onClientRender"rootnarastanie)

function wyswietl()
local temperatura getElementData(localPlayer"temperatura")
local temper1 string.format("%.02f"temperaturadxDrawText("Temperatura: "..temper1.." ?C "x/1.80y/6.51209835tocolor(25500255), 1.00"pricedown""left""top"falsefalsefalsefalsefalse)  
end
addEventHandler("onClientRender"rootwyswietl)

function zapisz()
local stan getElementData(localPlayer"temperatura")
end
addEventHandler("onClientPlayerQuit"rootzapisz)

function wczytaj()
if getElementData(localPlayer"temperatura"then
setElementData(localPlayer"temperatura"stan)
else
setElementData(localPlayer"temperatura"36.6)
end
end
addEventHandler("onPlayerLogin"rootwczytaj)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 12:54


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Poniewa? gdy wyjdziesz z serwera to ElemntData jest usuwana. Musia?by? zrobi? triggerServerEvent ?eby zapisywa?o temperatur? i odczytywa?o z AccountDaty.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 13:23


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Kod na zapisywanie po stronie serwer'a

function quitPlayer()
acc getPlayerAccount(source)
setAccountData(acc"temperatura"getElementData(source"temperatura")
addEventHandler "onPlayerQuit"getRootElement(), quitPlayer )



function loginPlayer(_konto)
if getAccountData(konto"temperatura"then
setElementData(source"temperatura"getAccountData(konto"temperatura")
else
setElementData(source"temperatura"36.6)
end
addEventHandler 'onPlayerLogin'getRootElement ( ), loginPlayer)


PS Nie testowane, bo mam do u?ytku jedynie lapka...
I te 2 funkcje oczywiscie po stronie serwer'a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 13:57


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

DestroY, nie pokazuje si? text. U?y?em tego twojego kodu po stronie serwera i tego mojego po stronie clienta z getElementData i nic.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:02


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Je?eli co? nie dzia?a, to podaj b??dy z db3 (/debugscript 3), wtedy jest znacznie pro?ciej rozwi?za? problem...
Ca?kiem mo?liwe, ?e ja co? porypa?em bo nawet nie mam jak tego przetestowa?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:08


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Prosz? :)

ERROR:MTA-Temperatura/temp.lua:2: attempt to perform 'arthimetic' on global 'nar' (a nil value)

ERROR:MTA-Temperatura/temp.lua:13: bad argument #2 to 'format' ( number expected, got boolean )

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:13


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3


function quitPlayer()
acc getPlayerAccount(source)
setAccountData(acc"temperatura"getElementData(source"temperatura"))
end
addEventHandler "onPlayerQuit"getRootElement(), quitPlayer )



function loginPlayer(_konto)
if getAccountData(konto"temperatura"then
setElementData(source"temperatura"getAccountData(konto"temperatura"))
else
setElementData(source"temperatura"36.6)
end
end
addEventHandler "onPlayerLogin"getRootElement ( ), loginPlayer)



Brakowa?o kilku end?w i nawias?w.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

GamerHD11, onPlayerLogin po stronie client.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:21


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
"piotr172" napisał/a:


Brakowa?o kilku end?w i nawias?w.


Ehh w?a?nie tak si? dzieje jak si? nie jest u siebie i nie odpali edytora :P


PS: Kod musisz sobie ponownie przerobi? na elementDaty :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:24


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

No tego clienta przerobi?em xD

Dalej nie dzia?a :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:29


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Strona clienta:

local xguiGetScreenSize()
local nar getTickCount() 

function narastanie()
if getTickCount()-nar 6000 then
nar getTickCount()
local temp getElementData(localPlayer"temperatura") or 0
temp1 temp 0.1
setElementData(localPlayer"temperatura"temp1)
end
end
addEventHandler("onClientRender"rootnarastanie)

function wyswietl()
local temperatura getElementData(localPlayer"temperatura")
local temper1 string.format("%.02f"temperaturadxDrawText("Temperatura: "..temper1.." ?C "x/1.80y/6.51209835tocolor(25500255), 1.00"pricedown""left""top"falsefalsefalsefalsefalse)  
end
addEventHandler("onClientRender"rootwyswietl)


Strona servera:

function quitPlayer()
acc getPlayerAccount(source)
setAccountData(acc"temperatura"getElementData(source"temperatura"))
end
addEventHandler "onPlayerQuit"getRootElement(), quitPlayer )



function loginPlayer(_konto)
if getAccountData(konto"temperatura"then
setElementData(source"temperatura"getAccountData(konto"temperatura"))
else
setElementData(source"temperatura"36.6)
end
end
addEventHandler "onPlayerLogin"getRootElement ( ), loginPlayer)



Testowane, u mnie dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-06, 14:37


GamerHD11







Wiek: 24
Na forum: 4260 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Dzi?kuje bardzo wszystkim co mi pomagali :) :piwo: Do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: temperatura
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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