Jump to content

Troll Face dxDrawImage


Recommended Posts

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 

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
Guest Guest4401
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.

Link to comment
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?

Link to comment
Guest Guest4401

Where is 3rd argument for removeEventHandler?

uaUfT.png

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.

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...