Dodajesz do bazy danych lub na setAccountData dat? rejestracji, a nast?pnie aktualn? dat? odejmujesz od daty rejestracji i b?dzie widoczny czas gry od rejestracji.
Jak by? chcia? pobiera? czas gry, gdy gracz jest na serwerze to musia?by? jeszcze u?y?
Nie mam poj?cia, czy Ci dobrze w tym momencie doradze, ale chyba dobrze ; p
Po wej?ciu klienta do gry :
Podpis
Jedyny kontakt ze mną to PW forum
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
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
na kliencie to rob, nie serwerze
Podpis
Jedyny kontakt ze mną to PW forum
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
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
na kliencie to rob, nie serwerze
I u?y? tylko tych kod?w, ju? nic z poprzednich ?
Dzi?ki wielkie.
No oczywiscie musisz jeszcze dodac event handler onClientPlayerJoin itd itd
changeSeconds tez wez z poprzednich funkcji
Podpis
Jedyny kontakt ze mną to PW forum
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
function czas()
start = getTickCount()
end
addEventHandler("onClientPlayerJoin", getRootElement(), czas)
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
I oczywi?cie koniec liczenia czasu..
function kczas()
czasKoncowy = getTickCount()-start/1000
end
addEventHandler( "onClientPlayerQuit", getRootElement(), kczas )
No jeste? blisko, tylko te funkcje changeSeconds, daj na sama gore kodu, w sensie zrodlo tej funkcji.
Podpis
Jedyny kontakt ze mną to PW forum
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
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
function czas()
start = getTickCount()
end
addEventHandler("onClientPlayerJoin", getRootElement(), czas)
function kczas()
czasKoncowy = getTickCount()-start/1000
end
addEventHandler( "onClientPlayerQuit", getRootElement(), kczas )
function changeSeconds(secs)
if tonumber(secs) then
if secs > 0 then
hours = secs/3600
minutes = secs%3600 / 60
end
end
return math.floor(hours), math.floor(minutes)
end
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
function czas()
start = getTickCount()
end
addEventHandler("onClientPlayerJoin", getRootElement(), czas)
function kczas()
czasKoncowy = getTickCount()-start/1000
end
addEventHandler( "onClientPlayerQuit", getRootElement(), kczas )
function changeSeconds(secs)
if tonumber(secs) then
if secs > 0 then
hours = secs/3600
minutes = secs%3600 / 60
end
end
return math.floor(hours), math.floor(minutes)
end
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
function czas()
start = getTickCount()
end
addEventHandler("onClientPlayerJoin", getRootElement(), czas)
function kczas()
czasKoncowy = getTickCount()-start/1000
end
addEventHandler( "onClientPlayerQuit", getRootElement(), kczas )
function changeSeconds(secs)
if tonumber(secs) then
if secs > 0 then
hours = secs/3600
minutes = secs%3600 / 60
end
end
return math.floor(hours), math.floor(minutes)
end
function czas()
start = getTickCount()
end
addEventHandler("onClientPlayerJoin", getRootElement(), czas)
addCommandHandler("czas", function(p, c)
local czas = getTickCount() - start / 1000
local h, m = changeSeconds(czas)
outputChatBox("Grasz : "..h.." godzin i "..m.." minut")
end)
function kczas()
czasKoncowy = getTickCount()-start/1000
end
addEventHandler( "onClientPlayerQuit", getRootElement(), kczas )
Podpis
Jedyny kontakt ze mną to PW forum
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
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