audi868 Posted September 25, 2011 Posted September 25, 2011 Firstly, I am having some problems with dx functions. Client addEvent("achUnlock",true) function AchieivementUnlocked ( txt ) dxDrawImage(439.0,625.0,409.0,83.0,"ach.png",0.0,0.0,0.0,tocolor(255,255,255,180),false) dxDrawText(txt,539.0,671.0,812.0,700.0,tocolor(0,0,0,255),0.5,"bankgothic","left","top",true,true,false) end function achUnlock ( txt ) addEventHandler("onClientRender",root,AchieivementUnlocked) AchieivementUnlocked( txt ) end addEventHandler("achUnlock", root, achUnlock) Server addCommandHandler("ach",function(s) triggerClientEvent(s, "achUnlock", s, "test") end ) Results: Bad argument @dxDrawText on line 4. Second, Is there a way to make the dxtext visible to a defined player only?
Aibo Posted September 25, 2011 Posted September 25, 2011 1. AchieivementUnlocked is called every frame when you attach it to "onClientRender". so "txt" variable is always nil in that calls. you should put your text to some variable, like: local achievementText addEvent("achUnlock",true) function AchieivementUnlocked() dxDrawImage(439.0,625.0,409.0,83.0,"ach.png",0.0,0.0,0.0,tocolor(255,255,255,180),false) dxDrawText(achievementText,539.0,671.0,812.0,700.0,tocolor(0,0,0,255),0.5,"bankgothic","left","top",true,true,false) end function achUnlock ( txt ) achievementText = txt addEventHandler("onClientRender", root, AchieivementUnlocked) end addEventHandler("achUnlock", root, achUnlock) 2. everything you'll do in a client script is visible only to single client. unless you trigger same event for everyone.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now