Bean666 Posted July 14, 2015 Posted July 14, 2015 Hello , is there anyway to lock a pickup for a team? thanks. Aftermath
Mr.Aleks Posted July 14, 2015 Posted July 14, 2015 Could you explain better what you wanna do? If you want to limit the use of the pickup only for the people of the team, you can create a condition with this useful function: https://wiki.multitheftauto.com/wiki/IsPlayerInTeam Some opportunities come once in a lifetime Skype: alex.migliore1
Bean666 Posted July 14, 2015 Author Posted July 14, 2015 example: i'll make an hp pickup locked for a team , not all people can get it , only people in the teamname "Alpha Team" will have access to that hp pickup. i tried making one but they're all a fail. Aftermath
Price. Posted July 14, 2015 Posted July 14, 2015 pick = createPickup (x, y, z, theType, 0, amount, model ) function pickup() for _, p in ipairs ( getElementsByType ( "player" ) ) do if getPlayerTeam(p) == getTeamFromName("Alpha Team") then setElementHealth(p, 100) else cancelEvent() end end addEventHandler("onPickupHit", getRootElement(), pickup) YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID
Dealman Posted July 14, 2015 Posted July 14, 2015 pick = createPickup (x, y, z, theType, 0, amount, model ) function pickup() for _, p in ipairs ( getElementsByType ( "player" ) ) do if getPlayerTeam(p) == getTeamFromName("Alpha Team") then setElementHealth(p, 100) else cancelEvent() end end addEventHandler("onPickupHit", getRootElement(), pickup) That would set the health for all the players in that team every time someone from Alpha Team hits it. Your function would also be triggered when any pickup is hit - not only when pick is hit. You could isolate it a bit further with more checks, which would give you more control - like this; local examplePickup = createPickup(...) function detectPickupHit_Handler(thePlayer) if(source == examplePickup and getPlayerTeam(thePlayer) == getTeamFromName("Example Team")) then -- Do your stuff here else cancelEvent() end end addEventHandler("onPickupHit", root, detectPickupHit_Handler) If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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