Jump to content

WhoAmI

Members
  • Posts

    1,248
  • Joined

  • Last visited

Everything posted by WhoAmI

  1. https://wiki.multitheftauto.com/wiki/Resource:DxDraw3DText#The_dxDraw3DText_function
  2. Biblioteka 'dx' wymaga renderowania co klatkę, więc dxDrawText musi być umieszczony w evencie onClientRender. function showPremium() local px,py,pz = getElementPosition(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz) if distance <= 10 then local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 ) if not sx then return end local scale = 0.01/(0.01 * (distance / 1)) dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07 *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false ) end end function premiumhud() addEventHandler("onClientRender", localPlayer, showPremium) end addCommandHandler("premium", premiumhud)
  3. Just post everything here - in the forum.
  4. This code you gave us looks okay, there is no error in it. So the point is that something must be badly scripted in this 'faction package'.
  5. Man, when player logs out he is no longer logged in. Look what argument onPlayerLogout event gives. account thePreviousAccount, account theCurrentAccount Do you see? So, addEventHandler("onPlayerLogout", getRootElement(), function (acc, _) local name = getPlayerName ( source ) if isObjectInACLGroup("user." .. getAccountName(acc), aclGetGroup("Admin")) then exports[getResourceName(resource)]:addNotification(root, name.." kilépett a tulajdonos szolgálatból!", "success") end end )
  6. "onClientKey" "onClientClick" setElementData getElementData dxDrawText
  7. You are just making tables witch each race mode storing players in it, and put them in different dimensions.
  8. So you want to get EVERY vehicle frozen while player exits vehicle?
  9. If owner exits the vehicle, just freeze it. setElementFrozen
  10. WhoAmI

    help

    If you want to collect how many kills did player get you have to make it s-side and store it in table. local kills = {} addEventHandler("onPlayerWasted", root, function(_, killer) if isElement(killer) and getElementType(killer) == "player" then local killInt = kills[killer] if not killInt then killInt = 0 end kills[killer] = killInt + 1 end end)
  11. Ask in your language section, we can't understand you.
  12. WhoAmI

    what's wrong?

    if guiGetText(editLogin) ~= "" and guiGetText(editPassword) ~= "" then --not empty end
  13. WhoAmI

    what's wrong?

    put LoginFromXML function before login,password variables.
  14. No problem. I've learned a lot about databases.
  15. Because you are setting online time to 0 setElementData(source, "Online Time", "0 minutes")
  16. This code works perfectly for me call ( getResourceFromName ( "scoreboard" ), "scoreboardAddColumn", "Play Time" ) ---Export of ScoreBoard function getOnlineTime(player, acc) if not isGuestAccount(acc) then local playedTime = getAccountData(acc, "onlineTime"); if not playedTime then playedTime = 0; end setAccountData(acc, "onlineTime", playedTime); setElementData(player, "onlineTime", playedTime); local timer = setTimer(function() setElementData(player, "onlineTime", getElementData(player, "onlineTime") + 1); updateScoreboard(player); end, 60000, 0); updateScoreboard(player); setElementData(player, "timer:onlineTime", timer); end end addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do getOnlineTime(player, getPlayerAccount(player)); end end); addEventHandler("onPlayerLogin", root, function(_, acc) getOnlineTime(source, acc); end); function updateScoreboard(player) local playTime = getElementData(player, "onlineTime"); if playTime then if playTime >= 0 and playTime < 60 then setElementData(player, "Play Time", playTime .. " minutes"); elseif playTime >= 60 and playTime < 1440 then playTime = math.floor(playTime / 60) setElementData(player, "Play Time", playTime .. " hours"); elseif playTime >= 1440 then playTime = math.floor(playTime / 1440) setElementData(player, "Play Time", playTime .. " days"); end end end function saveData(player, acc) if acc and not isGuestAccount(acc) then setAccountData(acc, "onlineTime", getElementData(player, "onlineTime")); if isTimer(getElementData(player, "timer:onlineTime")) then killTimer(getElementData(player, "timer:onlineTime")); end end end addEventHandler("onPlayerDisconnect", root, function() saveData(source, getPlayerAccount(source)); end); addEventHandler("onPlayerLogout", root, function(acc) saveData(source, acc); end); I have even created new account, just in case. Here are screens https://scr.hu/jPm0A1 https://scr.hu/63rMWO
  17. What the... man... Look updateScoreboard function. Everything works fine. I've tested it properly.
  18. Works for me now. Changed it a bit call ( getResourceFromName ( "scoreboard" ), "scoreboardAddColumn", "Play Time" ) ---Export of ScoreBoard function getOnlineTime(player, acc) if not isGuestAccount(acc) then local playedTime = getAccountData(acc, "onlineTime"); if not playedTime then playedTime = 0; end setElementData(player, "onlineTime", playedTime); local timer = setTimer(function() setElementData(player, "onlineTime", getElementData(player, "onlineTime") + 1); updateScoreboard(player); end, 60000, 0); updateScoreboard(player); setElementData(player, "timer:onlineTime", timer); end end addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do getOnlineTime(player, getPlayerAccount(player)); end end); addEventHandler("onPlayerLogin", root, function(_, acc) getOnlineTime(source, acc); end); function updateScoreboard(player) local playTime = getElementData(player, "onlineTime"); if playTime then if playTime >= 0 and playTime < 60 then setElementData(player, "Play Time", playTime .. " minutes"); elseif playTime >= 60 and playTime < 1440 then playTime = math.floor(playTime / 60) setElementData(player, "Play Time", playTime .. " hours"); elseif playTime >= 1440 then playTime = math.floor(playTime / 1440) setElementData(player, "Play Time", playTime .. " days"); end end end function saveData(player, acc) if acc and not isGuestAccount(acc) then setAccountData(acc, "onlineTime", getElementData(player, "onlineTime")); if isTimer(getElementData(player, "timer:onlineTime")) then killTimer(getElementData(player, "timer:onlineTime")); end end end addEventHandler("onPlayerDisconnect", root, function() saveData(source, getPlayerAccount(source)); end); addEventHandler("onPlayerLogout", root, function(acc) saveData(source, acc); end);
  19. Okay, I'll test this.
  20. It stores playtime in seconds, but shows it in format you wanted. @EDIT: Found the error. Replace last lines to this function saveData(player, acc) if acc and not isGuestAccount(acc) then setAccountData(acc, "onlineTime", getElementData(player, "onlineTime")); if isTimer(getElementData(player, "timer:onlineTime")) then killTimer(getElementData(player, "timer:onlineTime")); end end end addEventHandler("onPlayerDisconnect", root, function() saveData(source, getPlayerAccount(source)); end); addEventHandler("onPlayerLogout", root, function(acc) saveData(source, acc); end);
  21. That's the worst idea I've ever heard. That's not the way how we use database, c'mon.
×
×
  • Create New...