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

Wysłany: 2015-12-02, 17:42


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

System expa dzia?a ale dlaczego nie dzia?a to
czesc skryptu z clienta
local rangi={
{1, "Nowy", 0},
{2, "Poczatkujacy", 100},
}

function asd()
for k,v in ipairs(rangi) do
if getElementData(source, "Exp") >= tonumber(v[3]) then
setElementData(source, "Lvl", tonumber(v[1]))
setElementData(source, "Ranga", tonumber(v[2]))
else
return
end
end
end
addEventHandler("onClientRender", root, asd)

server (czesc)
addEventHandler("onPlayerLogin", root,
  function()
local acc = getPlayerAccount(source)
    for k,v in ipairs(rangi) do
        setElementData(source, "Exp", getAccountData(acc, "Exp"))
        setElementData(source, "Lvl", getAccountData(acc, "Lvl"))
        setElementData(source, "Ranga", getAccountData(acc, "Ranga"))
    if not getElementData(source, "Exp") or not getElementData(source, "Lvl") or not getElementData(source, "Ranga") then
    setElementData(source, "Exp", 0)
    setElementData(source, "Lvl", 1)
    setElementData(source, "Ranga", "Nowy")
    end
    end
  end
)

function quitPlayer()
local acc = getPlayerAccount(source)
    if acc then
      setAccountData(acc, "Exp", getElementData(source, "Exp"))    
      setAccountData(acc, "Lvl", getElementData(source, "Lvl"))    
      setAccountData(acc, "Ranga", getElementData(source, "Ranga"))    
    end
end
addEventHandler ( "onPlayerQuit", root, quitPlayer )
addEventHandler ( "onPlayerLogout", root, quitPlayer )
    

Blad w cliencie ta linijka
if getElementData(source, "Exp") >= tonumber(v[3]) then
attept to compare number with boolean

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-02, 17:43


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
Spr?buj to podmieni? na to:


if (getElementData(source, "Exp") or 0 ) >= (tonumber(v[3]) or 0) then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-02, 19:17


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Hymmm, skad masz to source tam?

&EDIT
Wiem, ?e to ?r?d?o eventu, ale zmie? to lepiej na localPlayer

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-03, 15:57


_Haze

Peace Yo!






Wiek: 25
Na forum: 4326 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Dzieki Jurand dobra wskaz?wka dzieki Destroy dzia?? tylko mam 1lvl na teamach i Randze xdddd i pytanko jak dac priorytet scorbordowi i szerokosc xd
http://imgur.com/QZ7QZ04
http://imgur.com/QZ7QZ04

+ bug jak ktos ma wiecej niz 1range lub lvl to sie zmienia np 6lvl cos tam itd jak to naprawic? R* R* :piwo: :piwo:

[ Dodano: 2015-12-03, 20:07 ]
ok juz nie trzeba fanciak mi pomogl do zamkniecia

Postaw piwo autorowi tego posta
 

 
Tagi: system :: lvl :: rang
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