Jump to content

How can i make this for 1 player only


micheal1230

Recommended Posts

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

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

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