Bean666 Posted June 12, 2016 Posted June 12, 2016 (edited) why does the weapon drop only on the north side?if im facing south , the weapon drops behind of me how to fix that? i want it to drop in front of your player. function drop(player,cmd,amount) local x,y,z = getElementPosition(player) local weapon = getPedWeapon(player) local ammo = getPedTotalAmmo(player) local amount = tonumber(amount) local x,y,z = getElementPosition(player) local rot = getPedRotation(player) if ammo >= amount then takeWeapon(player,weapon,amount) setElementID(createPickup(x,y+5,z,2,weapon,5000,amount),"WeaponPickUp") outputChatBox("*You Dropped the Weapon successfuly",player,0,255,0,true) else outputChatBox("*You Don't Have that "..amount..".",player,255,0,0,true) end end addCommandHandler("drop",drop) Edited June 15, 2016 by Guest
KariiiM Posted June 12, 2016 Posted June 12, 2016 function drop(player,cmd,amount) local x,y,z = getElementPosition(player) local weapon = getPedWeapon(player) local ammo = getPedTotalAmmo(player) local amount = tonumber(amount) local x,y,z = getElementPosition(player) local rot = getPedRotation(player) if ammo >= amount then takeWeapon(player,weapon,amount) setElementID(createPickup(x+5,y,z,2,weapon,5000,amount),"WeaponPickUp") outputChatBox("*You Dropped the Weapon successfuly",player,0,255,0,true) else outputChatBox("*You Don't Have that "..amount..".",player,255,0,0,true) end end addCommandHandler("drop",drop)
Bean666 Posted June 12, 2016 Author Posted June 12, 2016 ok now it's spawning in the east side lol...
denny199 Posted June 15, 2016 Posted June 15, 2016 Use this function: function getPositionInfrontOfElement(element, meters) local posX, posY, posZ = getElementPosition(element) local _, _, rotation = getElementRotation(element) posX = posX - math.sin(math.rad(rotation)) * meters posY = posY + math.cos(math.rad(rotation)) * meters return posX, posY, posZ end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now