-
Posts
1,248 -
Joined
-
Last visited
Posts posted by WhoAmI
-
-
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)
-
guiCreateLabel onClientGUIClick
-
Just post everything here - in the forum.
-
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'.
-
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 )
- 1
-
"onClientKey" "onClientClick" setElementData getElementData dxDrawText
-
You are just making tables witch each race mode storing players in it, and put them in different dimensions.
-
No problem.
-
So you want to get EVERY vehicle frozen while player exits vehicle?
-
If owner exits the vehicle, just freeze it.
-
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)
-
Ask in your language section, we can't understand you.
-
Explain more.
-
if guiGetText(editLogin) ~= "" and guiGetText(editPassword) ~= "" then --not empty end
-
put LoginFromXML function before login,password variables.
-
No problem. I've learned a lot about databases.
-
Because you are setting online time to 0
setElementData(source, "Online Time", "0 minutes")
-
You're welcome.
-
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
-
What the... man... Look updateScoreboard function. Everything works fine. I've tested it properly.
-
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);
-
Okay, I'll test this.
-
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);
-
That's the worst idea I've ever heard. That's not the way how we use database, c'mon.
[Help] Name Tags or VIP rank
in Scripting
Posted
https://wiki.multitheftauto.com/wiki/Resource:DxDraw3DText#The_dxDraw3DText_function