micheal1230 Posted August 13, 2012 Share Posted August 13, 2012 (edited) Well i want to make the pic come up for the player that types the command(the serverside works so no need for it) addEvent("myEvent",true) addEventHandler("myEvent",root, function() addEventHandler("onClientRender",getLocalPlayer ( ),drawTheImage) end ) function drawTheImage(image) local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500,'stuff.jpg', 0, -120 ) end addEvent("stopEvent",true) addEventHandler("stopEvent",root, function() removeEventHandler("onClientRender",getLocalPlayer ( ),drawTheImage) end ) Server addCommandHandler("pic", function(player) triggerClientEvent("myEvent",player) end ) addCommandHandler("nopic", function(player) triggerClientEvent("stopEvent",player) end ) Edited August 13, 2012 by Guest Link to comment
Callum Posted August 13, 2012 Share Posted August 13, 2012 You need to show your server-side code that uses triggerClientEvent, as it will be triggering for the root element. Link to comment
micheal1230 Posted August 13, 2012 Author Share Posted August 13, 2012 You need to show your server-side code that uses triggerClientEvent, as it will be triggering for the root element. Done Link to comment
Guest Guest4401 Posted August 13, 2012 Share Posted August 13, 2012 Looks like you didn't have a closer look at the last 3 posts here: viewtopic.php?f=91&t=44026 Anyway, let me do this for you. I've not tested this, so if it doesn't work then I hope you can fix it yourself. local enabled = false addCommandHandler("pic", function() enabled = true end ) addCommandHandler("nopic", function() enabled = false end ) addEventHandler("onClientRender", root, function() if enabled then dxDrawImage(guiGetScreenSize()/2-50,50,500,500,'stuff.jpg',0,-120) end end ) 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