micheal1230 Posted May 26, 2012 Posted May 26, 2012 Well There is no debugscript 3 error but the image only shows for about 1 seconds and it is not over the whole server just the person that types the command is shows for function troll() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end addCommandHandler("problem",troll) function trollRender ( ) addEventHandler("onClientRender", getRootElement(), troll) -- Keep everything visible with onClientRender. end
Wei Posted May 26, 2012 Posted May 26, 2012 function troll() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end function cmd() addEventHandler("onClientRender", getRootElement(), troll) end addCommandHandler("problem",cmd) try
micheal1230 Posted May 26, 2012 Author Posted May 26, 2012 function troll() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end function cmd() addEventHandler("onClientRender", getRootElement(), troll) end addCommandHandler("problem",cmd) try Nope
micheal1230 Posted May 26, 2012 Author Posted May 26, 2012 Well There is no debugscript 3 error but the image only shows for about 1 seconds and it is not over the whole server just the person that types the command is shows for function troll() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end addCommandHandler("problem",troll) function trollRender ( ) addEventHandler("onClientRender", getRootElement(), troll) -- Keep everything visible with onClientRender. end HELLO YOu DONT UNDERSTAND I WANT IT TO SHOW FOR THE WHOLE SERVER WHEN YOU TYPE THAT COMMAND BUT IT ONLY FLASHS AND SHOWS FOR THE PLAYER TYPING THE COMMAND
Guest Guest4401 Posted May 26, 2012 Posted May 26, 2012 it is not over the whole server just the person that types the command is shows for If you want the image to be shown to everyone with a command, then you must trigger it for every client like this. --server side addCommandHandler("problem", function(player) triggerClientEvent("myEvent",player) end ) --clientside addEvent("myEvent",true) addEventHandler("myEvent",root, function() addEventHandler("onClientRender",root,drawTheImage) end ) function drawTheImage() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end And next time, be a bit more polite. Thanks.
micheal1230 Posted May 26, 2012 Author Posted May 26, 2012 it is not over the whole server just the person that types the command is shows for If you want the image to be shown to everyone with a command, then you must trigger it for every client like this. --server side addCommandHandler("problem", function(player) triggerClientEvent("myEvent",player) end ) --clientside addEvent("myEvent",true) addEventHandler("myEvent",root, function() addEventHandler("onClientRender",root,drawTheImage) end ) function drawTheImage() local screenWidth,screenHeight = guiGetScreenSize() dxDrawImage ( screenWidth/2 - 50, 50, 500, 500, 'troll.jpg', 0, -120 ) end And next time, be a bit more polite. Thanks. Thanks Mate And Sorry But How Can I Turn It Off When Activated?
micheal1230 Posted May 26, 2012 Author Posted May 26, 2012 removeEventHandler Ok Thanks I cant get it to work -- ClientSide! addCommandHandler("stopproblem", function(player) removeEventHandler("myEvent",player) end )
Guest Guest4401 Posted May 26, 2012 Posted May 26, 2012 Where is 3rd argument for removeEventHandler? And the first parameter is not player in addCommandHandler if used client side. You must use localPlayer if a player has to stop it for himself. If for all, then trigger from server to client.
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