Jump to content

Solved...


1LoL1

Recommended Posts

Posted (edited)

Hello, i created script but idk how i need functions. :(

i need player must be in pickup and must use bindKey("lalt") but idk how :(

For player must be in pickup i must use this?

isElementAttached 

and this i have

job = createPickup (x, y, z, nil, id, timer) 
  
function Job (thePlayer) 
local job = setPlayerTeam(thePlayer, team) 
if job then 
else 
cancelEvent() 
outputChatBox("text", thePlayer, 255, 255, 255, true) 
end 
end 
addEventHandler("onPickupHit", job, Job) 

so i must use this?

job = createPickup (x, y, z, nil, id, timer) 
  
function Job (thePlayer) 
local job = setPlayerTeam(thePlayer, team) 
if job then 
else 
cancelEvent() 
outputChatBox("text", thePlayer, 255, 255, 255, true) 
end 
end 
bindKey(thePlayer, "lalt", "down", Job) 

Edited by Guest
Posted
What you want to do and can you explain your problem more better?

Not it's only when i take pickup. I need "thePlayer must be in pickup and must use "lalt" if thePlayer is not in pickup then can't use bindKey.

Posted

Hmm, as far as the event onPickupLeave not exists, it's possible to make a custom event,

You'll have to get the distance between the player and the pickup for example if the distance is more than 2meters then unbind the key.

Use these functions

getDistanceBetweenPoints3D 
--or 
getDistanceBetweenPoints2D 
unbindKey 
  

Posted
Hmm, as far as the event onPickupLeave not exists, it's possible to make a custom event,

You'll have to get the distance between the player and the pickup for example if the distance is more than 2meters then unbind the key.

Use these functions

getDistanceBetweenPoints3D 
--or 
getDistanceBetweenPoints2D 
unbindKey 
  

Not i mean player must be in pickup if want use bindKey and only now will script work when player will be in pickup.

Posted

Agree with what Karim said,

first you bindKey on the event "onPickupHit" and then make a custom event and get distance between two points , if distance exceeds by 4 or 5 then unbind the key , so the key will be bound till the player is near the pickup

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