BriGhtx3 Posted October 8, 2011 Share Posted October 8, 2011 client function StrafHandler ( gesch, money ) GUIEditor_Label = {} img = guiCreateStaticImage(392,0,407,268,"Blitzer.png",false) guiSetAlpha(img,0.89999997615814) GUIEditor_Label[1] = guiCreateLabel(592,97,195,35,"Bahnhof",false) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"sa-header") setTimer(ausblenden, 3000, 1) end addEvent( "onStrafe", true ) addEventHandler( "onStrafe", getRootElement(), StrafHandler ) function ausblenden() guiSetVisible(img, false) end server local within = isElementWithinColShape( hitElement, circle) if within then local money = vioGetElementData(hitElement, "money") speedx, speedy, speedz = getElementVelocity (hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 geld = kmh/100*200 if kmh > 80 then triggerClientEvent(hitElement,"onStrafe", getRootElement(), kmh, geld) end end When I drive through the sphere the image appears. After 3 seconds it hides. When I drive through it a second time then it appears twice and doesn't hide. Link to comment
Castillo Posted October 8, 2011 Share Posted October 8, 2011 You should check if the image already exists, if so, show it, else create it. function StrafHandler ( gesch, money ) if not img then GUIEditor_Label = {} img = guiCreateStaticImage(392,0,407,268,"Blitzer.png",false) guiSetAlpha(img,0.89999997615814) GUIEditor_Label[1] = guiCreateLabel(592,97,195,35,"Bahnhof",false) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"sa-header") setTimer(ausblenden, 3000, 1) else guiSetVisible(img, true) end end addEvent( "onStrafe", true ) addEventHandler( "onStrafe", getRootElement(), StrafHandler ) function ausblenden() if not img then return end guiSetVisible(img, false) end Test it. Link to comment
BriGhtx3 Posted October 8, 2011 Author Share Posted October 8, 2011 I tried it exactly like this before. Now the image doesn't appear at all. Just like the text Link to comment
Castillo Posted October 8, 2011 Share Posted October 8, 2011 I tried it, and works fine, are you sure your image place is right? Link to comment
BriGhtx3 Posted October 9, 2011 Author Share Posted October 9, 2011 So I got it. You/I forgot the setTimer in the "else" of "if not img then". Link to comment
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