Jump to content

check the time that the player is online


raynner

Recommended Posts

I've done what I wanted in a simple way, I now have another problem:(
I can not use setElementData to ProgressBar

This is the proto tico works the way I want timer in SetTimer for testing.

---
XpBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false)
LevelBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false)
---
addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),
function ()
	guiSetAlpha(XpBar,0)
	guiSetAlpha(LevelBar,0)
	XP = guiProgressBarGetProgress(XpBar)
	LVL = guiProgressBarGetProgress(LevelBar)
	setTimer (DropXpPerTimer, 1000, 0, getLocalPlayer())
end)
---

this is what I wanted to do originally because I want givar xp by doing some things on the server and check the level for him to carry out certain work.

---
XpBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false)
LevelBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false)
---
addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),
function ()
	guiSetAlpha(XpBar,0)
	guiSetAlpha(LevelBar,0)
	XP = guiProgressBarGetProgress(XpBar)
	LVL = guiProgressBarGetProgress(LevelBar)
	setElementData(XP,"XPThePlayer",true)
	setElementData(LVL,"LVLThePlayer",true)
	setTimer (DropXpPerTimer, 1000, 0, getLocalPlayer())
end)
---

I wanted to use the getElementData from then.

---
function DropXpPerTimer(player)
	if (player == getLocalPlayer()) then
		guiProgressBarSetProgress(XpBar,guiProgressBarGetProgress(XpBar)+1)
		if guiProgressBarGetProgress(XpBar) ~= 100 then
			outputChatBox("#FFAA00||#FFFF00  ❗ #FFAA00||#00FF7B +1 #00FF00De #00FF7BXP #00FF00...",255,255,255,true)
		end
		if (guiProgressBarGetProgress(XpBar) == 100) then
			guiProgressBarSetProgress(XpBar, 0)
			guiProgressBarSetProgress(LevelBar,guiProgressBarGetProgress(XpBar)+1)
			outputChatBox("#FFAA00||#FFFF00  ❗ #FFAA00||#00FF00 ......"..guiProgressBarGetProgress(LevelBar).."#00FF00.",255,255,255,true)
		end
	end
end
---

But he always sends me a debug error saying that I used a bad argument and value = 0

Edited by raynner
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...