-
Posts
370 -
Joined
-
Last visited
-
Days Won
2
Everything posted by AJXB
-
I couldn't find a way to fix the current script, can you try to fix it before I change the timers?
-
What do you think I should do with the timers?
-
local playTimeTimer = {} function loadPlayTime(_,account) local minutes = getAccountData(account, "playTime") if (tonumber(minutes)) then minutes = tonumber(minutes) local hours = math.floor(minutes / 60) if (hours > 0) then setElementData(source, "playTime", hours.." Hours") else setElementData(source, "playTime", minutes.." Minutes") end else setAccountData(account, "playTime", 0) setElementData(source, "playTime", "0 Minutes") end playTimeTimer[source] = setTimer(incrementPlayTime, 60000, 0, source) end addEventHandler("onPlayerLogin", root, loadPlayTime) function stopPlayTime() if (isTimer(playTimeTimer[source])) then killTimer(playTimeTimer[source]) end end addEventHandler("onPlayerLogout", root, stopPlayTime) addEventHandler("onPlayerQuit", root, stopPlayTime) function incrementPlayTime(player) if (not player or not isElement(player)) then return end if (isGuestAccount(getPlayerAccount(player))) then return end local account = getPlayerAccount(player) local minutes = getAccountData(account, "playTime") or 1 minutes = tonumber(minutes) minutes = minutes + 1 local hours = math.floor(minutes / 60) if (hours > 0) then setElementData(player, "playTime", hours.." Hours") else setElementData(player, "playTime", minutes.." Minutes") end setAccountData(account, "playTime", minutes) end This is the code, somehow when the player is playing time adds, but when he reconnects, his time sets to 0
-
It won't save/load The time adds to ElementData But when I reconnect the time is gone.
-
function loadPlayTime(account) local minutes = getAccountData(account, "playTime") if (tonumber(minutes)) then minutes = tonumber(minutes) local hours = math.floor(minutes / 60) if (hours > 0) then setElementData(source, "playTime", hours.." Hours") else setElementData(source, "playTime", minutes.." Minutes") end else setAccountData(account, "playTime", 0) setElementData(source, "playTime", "0 Minutes") end playTimeTimer[source] = setTimer(incrementPlayTime, 60000, 0, source) end addEventHandler("onPlayerLogin", root, loadPlayTime) Save side: function incrementPlayTime(player) if (not player or not isElement(player)) then return end if (isGuestAccount(getPlayerAccount(player))) then return end local account = getPlayerAccount(player) local minutes = getAccountData(account, "playTime") or 1 minutes = tonumber(minutes) minutes = minutes + 1 local hours = math.floor(minutes / 60) if (hours > 0) then setElementData(player, "playTime", hours.." Hours") else setElementData(player, "playTime", minutes.." Minutes") end setAccountData(account, "playTime", minutes) end What's wrong with this?
-
Main function and a sub function works on timer, what's the problem? function test () local curAcc = getPlayerAccount(source) setAccountData(curAcc,"Test",true) setTimer ( function () spawnPlayer(source,1186, -1323, 14 + 0.5,0,skin) setElementHealth (source,100) end,7500,1) end Bad argument for spawnPlayer and setElementHealth, expected element
-
I have this client side event: mainLoginWindow = guiCreateWindow(0,0,100,100,"Window",false) addEvent ( "setLoginWindowVisable", true ) function showLoginWindow () guiSetVisible (mainLoginWindow, true) enableCursor ( true ) end addEventHandler( "setLoginWindowVisable", root, showLoginWindow ) It's triggered using this on the server side: addEventHandler ("onPlayerJoin",root, function () triggerClientEvent( source, "setLoginWindowVisable", source ) end ) Yet GUI Window doesn't show, problem?
-
Steps: 1. Install another server with another dir. 2. Change server port from mta-server.conf 3. you can simply use screen for starting multiple servers. I don't understand where is the problem?
-
You can use "screen" command to manage windows. Install it using: #sudo apt-get install screen screen-profiles screen-profiles-extras to list the screens: #screen to choose: #screen -S [screen Number] Wish I'm being correct. Just to point out the ports thing [each server different ports].
-
Can you provide your VPS OS?
-
When I execute the command: /debugscript 3 the box on the bottom of the screen appears but with no text at all Solution?
-
http://pastebin.mtasa.com/310244020 Omg that log is everything on my PC MTADiag is simply awsome!
-
http://pastebin.mtasa.com/error[No code2 specified] I'm not sure that it gave me a working URL, it just copied this to my clipboard Still the same problem
-
Thanks for your reply! I re installed MTA:SA Client, the problem stays It started just a while earlier.