Bombix95 Posted May 26, 2014 Posted May 26, 2014 Hi guys, i'm here for an obvious problem I have this idea in my mind and I want to spare it with all of you. I want to build an Active Protection Shield (APS) for a specific class on MTA and i was thinking about doing an object, a sphere in this case and make a COL file and it must behave as following: - the player that's using the APS must be able to shoot from inside to the outside enemies, so he/she can kill'em; - other enemies can't shoot to the player that's using the APS, well they can but their bullets must be stopped by the shield; - all players can walk, run, jump through the shield as it must ignore collisions with everything except for bullets. Now the model is already done, but i dont know how to ignore shoot collision for the player using the APS and activate shoot collision for enemies outside it. For better explanation i put an image below. I hope someone can help me and thanks in advance
xXMADEXx Posted May 27, 2014 Posted May 27, 2014 You could make a colshape, and when a player is damaged (onClientPlayerDamage) check to see if they're in the colshape. If they are then you can use cancelEvent() The Ultimate Lua Tutorial! | MTA PHP SDK
Bombix95 Posted May 27, 2014 Author Posted May 27, 2014 Colshape, I will look into the wiki to see how i can implement it. Thanks a lot xXMadeXx, you helped me a lot with this info. I'll be back soon with some results, positive if possible . Bye
#RooTs Posted May 27, 2014 Posted May 27, 2014 try this Client.lua addEventHandler ( "onClientPlayerDamage",root, function () if getElementData(source,"invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end) bindKey("1","down","protect") Server.lua function togglestaff(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("#00BFFFA Protect of: #FF0000".. getPlayerName(thePlayer) .." #FF0000OFF", getRootElement(),255,0,0,true) else setElementData(thePlayer,"invincible",true) outputChatBox("#00BFFFA Protect of: #FF0000".. getPlayerName(thePlayer) .." #00FF00ON", getRootElement(),255,0,0,true) end end end addCommandHandler("protect",togglestaff)
Bombix95 Posted May 27, 2014 Author Posted May 27, 2014 thank u guys, both of u helped me a lot. now...let's get to work
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