BorderLine Posted February 3, 2012 Share Posted February 3, 2012 Hi again I was mading this script. Is about enable and dissable godmode when you enter to radar area My server have godmode for all players. but i want make something with radar areas. I mean when player join to radar area, the god mode mustbe disabled. and when the playear leave the area, god mode enabled. I have this but i dont know how complete the leavezone Serverside safecol = createColCuboid ( 732, -2577, 0, 120, 150, 40 ) safeZoneRadar = createRadarArea ( 732, -2577, 120, 150, 0, 0, 0, 200 ) setElementData (safeZoneRadar, "zombieProof", true) function enterZone(hitPlayer,thePlayer) local account = getPlayerAccount(hitPlayer) if not isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then triggerClientEvent ("godmode",getLocalPlayer(),godmode) end end addEventHandler( "onColShapeHit", safecol, enterZone ) function leaveZone(hitPlayer,thePlayer) local account = getPlayerAccount(hitPlayer) if not isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin ) ) then -- here i dont know what i do end end addEventHandler( "onColShapeLeave", safecol, leaveZone ) clientside function godmode(attacker, weapon, bodypart) cancelEvent() end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godmode) or if exist some way better than this. Thanks for your time and attention Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 -- server side: safecol = createColCuboid ( 732, -2577, 0, 120, 150, 40 ) safeZoneRadar = createRadarArea ( 732, -2577, 120, 150, 0, 0, 0, 200 ) setElementData (safeZoneRadar, "zombieProof", true) function enterZone(hitPlayer) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementData(hitPlayer,"godMode",false) end end addEventHandler( "onColShapeHit", safecol, enterZone ) function leaveZone(hitPlayer) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementData(hitPlayer,"godMode",true) end end addEventHandler( "onColShapeLeave", safecol, leaveZone ) -- client side: function godmode() if (getElementData(localPlayer,"godMode")) then cancelEvent() end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godmode) Link to comment
Cadu12 Posted February 3, 2012 Share Posted February 3, 2012 @Solidsnake14: Remove "not" from "if", else it will use godmode with guest or without admin. Link to comment
BorderLine Posted February 3, 2012 Author Share Posted February 3, 2012 @Solidsnake14: Remove "not" from "if", else it will use godmode with guest or without admin. why? i dont understand, if the player isnt adm so godmode = false but with that code, if player is adm godmode = false can only godmode =falde only for guest players? or mustbe like this? with admins and guests Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Do you mean that the god mode will be disabled and enabled for everyone? not just Admins. If so: safecol = createColCuboid ( 732, -2577, 0, 120, 150, 40 ) safeZoneRadar = createRadarArea ( 732, -2577, 120, 150, 0, 0, 0, 200 ) setElementData (safeZoneRadar, "zombieProof", true) function enterZone(hitPlayer) setElementData(hitPlayer,"godMode",false) end addEventHandler( "onColShapeHit", safecol, enterZone ) function leaveZone(hitPlayer) setElementData(hitPlayer,"godMode",true) end addEventHandler( "onColShapeLeave", safecol, leaveZone ) Link to comment
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