Jump to content

Pirate_SHIP


PaulDK

Recommended Posts

Hello brothers :D i want a little help in my Pirate Script i want if i leave in the Cuboid give money to players will stop. Thanks please Help me :? Thanks in Advance :)

This is the Script :

Cuboid1 = createColCuboid(1995.8243408203, 1517.3013916016, 13.53852558136, 100, 14, 100)

Blip = createBlip(2003, 1533, 35, 19, 2, 0, 0, 0, 255, 0, 500, getRootElement())

addEventHandler('onColShapeHit', Cuboid1,

function( player )

outputChatBox("#FFFFFFYou Entered in Pirate Boat REWARD:#00FF00You will get Random Money", player, 0, 0, 0, true)

setTimer(function()

givePlayerMoney(player,math.random(50, 500))

end, 2000, 0 )

end

)

addEventHandler('onColShapeLeave', Cuboid1,

function( player )

outputChatBox("#FFFFFFYou Leaved in Pirate Boat", player, 0, 0, 0, true)

return

cancelEvent()

end

)

Link to comment

When you hit the col shape, you need to apply a timer to get if the player is in the col shape every so often and if it returns true, you give him the money, if it returns false, destroy the timer or if he leaves the col shape, destroy the timer.

EDIT: You basically done that, but try this:

Cuboid1 = createColCuboid(1995.8243408203, 1517.3013916016, 13.53852558136, 100, 14, 100) 
Blip = createBlip(2003, 1533, 35, 19, 2, 0, 0, 0, 255, 0, 500, getRootElement()) 
  
addEventHandler('onColShapeHit', Cuboid1, 
function( player ) 
outputChatBox("#FFFFFFYou Entered in Pirate Boat REWARD:#00FF00You will get Random Money", player, 0, 0, 0, true) 
    theMoneyTimer = setTimer(function() 
    if isElementWithinColShape(p,Cuboid1) then 
    givePlayerMoney(p,math.random(50, 500)) 
    elseif isTimer(theMoneyTimer) then 
        destroyTimer(theMoneyTimer) 
    end 
    end, 2000, 0 ) 
end 
) 
addEventHandler('onColShapeLeave', Cuboid1, 
function( player ) 
outputChatBox("#FFFFFFYou Leaved in Pirate Boat", player, 0, 0, 0, true) 
    if isTimer(theMoneyTimer) then 
    destroyTimer(theMoneyTimer) 
    end 
end 
) 

Edited by Guest
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...