Jump to content

PickupHit[ClientSide]


PaulDK

Recommended Posts

Hello Everyone. I need Help. i want if i hit in the pickup the function drawStuff will start can anyone help me :?:

and also if you leave in the pickup it will destroy :)

sorry for my Bad English..

Here's the Script....

infoz = createPickup(2000.5545654297, 1538.30, 13.7, 3, 1239, 0, 1)

local x,y = guiGetScreenSize()

local Text = "This is a Pirate Ship that gives"

local Text2 = "Money If you Stay here you will"

local Text3 = "Get a lot of Money........."

local Text4 = "Created BY : PaulDK"

local Text5 = "Keep Calm And Enjoy :)"

function drawStuff()

dxDrawRectangle ( x/18, y/3, x/3.5, y/3, tocolor ( 0, 0, 0, 180 ) )

dxDrawText ( "INFORMATION", x/6.5, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 0.8, "default-bold" )

dxDrawText ( Text, x/12, y/2.7, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" )

dxDrawText ( Text2, x/12, y/2.5, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" )

dxDrawText ( Text3, x/12, y/2.3, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" )

dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" )

dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" )

end

addEventHandler("onClientRender", root, drawStuff)

Link to comment
  • Moderators

try: (not tested)

  
infoz = createPickup(2000.5545654297, 1538.30, 13.7, 3, 1239, 0, 1) 
  
local x,y = guiGetScreenSize() 
local Text = "This is a Pirate Ship that gives" 
local Text2 = "Money If you Stay here you will" 
local Text3 = "Get a lot of Money........." 
local Text4 = "Created BY : PaulDK" 
local Text5 = "Keep Calm And Enjoy \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" />" 
  
  
local lastInfoPickupHit = 0 
local pickupInfoHandler = false 
function drawStuff() 
    if lastInfoPickupHit < getTickCount() then 
        if pickupInfoHandler then 
            pickupInfoHandler = false 
            removeEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
    dxDrawRectangle ( x/18, y/3, x/3.5, y/3, tocolor ( 0, 0, 0, 180 ) ) 
    dxDrawText ( "INFORMATION", x/6.5, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 0.8, "default-bold" ) 
    dxDrawText ( Text, x/12, y/2.7, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    dxDrawText ( Text2, x/12, y/2.5, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    dxDrawText ( Text3, x/12, y/2.3, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" ) 
end 
  
  
addEventHandler("onClientPickupHit", infoz, 
function (player,matchingDimension) 
    if player == localPlayer and matchingDimension then 
        lastInfoPickupHit = getTickCount()+5000 
        if not pickupInfoHandler then 
            pickupInfoHandler = true 
            addEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
end) 

Link to comment
  • Moderators
in the addEventHandler("onClientRender", root, drawwStuff) root = getRootElement()

if 1 player hit in the pickup it will show to all...

Events only use the elements of the root which are useful. Since the player-elements are not very useful for rendering every frame............... you don't have to worry about that. :roll:

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