Narutimmy Posted April 3, 2013 Share Posted April 3, 2013 Hola bueno lo que sucede es que uso este scrip para crear una zona Segura, el problema es que por ejemplo yo estoy en zona verde y ago logout y entro de nuevo la SafeZone no sirve, debo salir y volver a entrar lo que es un gran problema porque ahi esta el Respawn y los jugadores noobs se ponen a matar a los que recien aparecen. -- Advanced Anti Zombie by Kenix version 1.0.6 --[[ It's example how use it. Change this ]] local aSavePlaces = { Rectangle = { -- X, Y, Width, Height { -3000.1, 2100.1, 800, 800 }; { -250, -150, 500, 300 }; }; } local aRadarAreaPlaces = { -- x, y ,size 1, size 2, color: red, green, blue, alpha. { -3000.1, 2100.1, 800, 800, 0, 255, 0, 100 }; { -250, -150, 500, 300, 0, 255, 0, 100 }; } local sResourceName = getResourceName ( resource ) local bUseGunsInSavePlace = get( sResourceName .. '.UseGunsInSaveZone' ) local bUseRadarArea = get( sResourceName .. '.UseRadarArea' ) local pColshape, pRadarArea local bUseRunInSaveZone = get( sResourceName .. '.UseRunInSaveZone' ) local bUseJumpInSaveZone = get( sResourceName .. '.UseJumpInSaveZone' ) local bUseWeaponHudInSaveZone = get( sResourceName .. '.UseWeaponHudInSaveZone' ) local bUseAmmoHudInSaveZone = get( sResourceName .. '.UseAmmoHudInSaveZone' ) local bUseDamageInSaveZone = get( sResourceName .. '.UseDamageInSaveZone' ) addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for s, _ in pairs( aSavePlaces ) do for _, a in pairs( aSavePlaces[ s ] ) do pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) setElementData( pColshape, 'zombieProof', true ) addEventHandler ( 'onColShapeHit', pColshape, function ( pHitElement ) if getElementType( pHitElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pHitElement, 'fire', false ) toggleControl ( pHitElement, 'aim_weapon', false ) toggleControl ( pHitElement, 'vehicle_fire', false ) end if not bUseRunInSaveZone then toggleControl ( pHitElement, 'sprint', false ) end if not bUseJumpInSaveZone then toggleControl ( pHitElement, 'jump', false ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pHitElement, 'weapon', false ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pHitElement, 'ammo', false ) end if not bUseDamageInSaveZone then setElementData( pHitElement, 'damage', 'no' ) end elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it killPed( pHitElement ) -- kill ped end end ) addEventHandler ( 'onColShapeLeave', pColshape, function ( pLeaveElement ) if getElementType( pLeaveElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pLeaveElement, 'fire', true ) toggleControl ( pLeaveElement, 'aim_weapon', true ) toggleControl ( pLeaveElement, 'vehicle_fire', true ) end if not bUseRunInSaveZone then toggleControl ( pLeaveElement, 'sprint', true ) end if not bUseJumpInSaveZone then toggleControl ( pLeaveElement, 'jump', true ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'weapon', true ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'ammo', true ) end if not bUseDamageInSaveZone then setElementData( pLeaveElement, 'damage', 'yes' ) end elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it killPed( pLeaveElement ) -- kill ped end end ) end end if bUseRadarArea then for _, a in ipairs( aRadarAreaPlaces ) do pRadarArea = createRadarArea ( unpack( a ) ) end end end ) Link to comment
Narutimmy Posted April 3, 2013 Author Share Posted April 3, 2013 Si es el único spawn en tu server, podrías, poner la función que tienes onColShapeHit también en onPlayerSpawn y luego, cuando el jugador salga de la zona, entonces, eliminas la función y listo. ._. mierda porque no se me ocurrio antes >.< Link to comment
Narutimmy Posted April 9, 2013 Author Share Posted April 9, 2013 Si es el único spawn en tu server, podrías, poner la función que tienes onColShapeHit también en onPlayerSpawn y luego, cuando el jugador salga de la zona, entonces, eliminas la función y listo. Me pueden explicar como ... lo intente pero no funciona y es una masacre en el area segura. Link to comment
Sasu Posted April 10, 2013 Share Posted April 10, 2013 Intenta si te funciona asi: -- Advanced Anti Zombie by Kenix version 1.0.6 --[[ It's example how use it. Change this ]] local aSavePlaces = { Rectangle = { -- X, Y, Width, Height { -3000.1, 2100.1, 800, 800 }; { -250, -150, 500, 300 }; }; } local aRadarAreaPlaces = { -- x, y ,size 1, size 2, color: red, green, blue, alpha. { -3000.1, 2100.1, 800, 800, 0, 255, 0, 100 }; { -250, -150, 500, 300, 0, 255, 0, 100 }; } local sResourceName = getResourceName ( resource ) local bUseGunsInSavePlace = get( sResourceName .. '.UseGunsInSaveZone' ) local bUseRadarArea = get( sResourceName .. '.UseRadarArea' ) local pColshape, pRadarArea local bUseRunInSaveZone = get( sResourceName .. '.UseRunInSaveZone' ) local bUseJumpInSaveZone = get( sResourceName .. '.UseJumpInSaveZone' ) local bUseWeaponHudInSaveZone = get( sResourceName .. '.UseWeaponHudInSaveZone' ) local bUseAmmoHudInSaveZone = get( sResourceName .. '.UseAmmoHudInSaveZone' ) local bUseDamageInSaveZone = get( sResourceName .. '.UseDamageInSaveZone' ) function enter( pHitElement ) if isElementWithinColShape ( pHitElement, pColshape ) then if getElementType( pHitElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pHitElement, 'fire', false ) toggleControl ( pHitElement, 'aim_weapon', false ) toggleControl ( pHitElement, 'vehicle_fire', false ) end if not bUseRunInSaveZone then toggleControl ( pHitElement, 'sprint', false ) end if not bUseJumpInSaveZone then toggleControl ( pHitElement, 'jump', false ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pHitElement, 'weapon', false ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pHitElement, 'ammo', false ) end if not bUseDamageInSaveZone then setElementData( pHitElement, 'damage', 'no' ) end elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it killPed( pHitElement ) -- kill ped end end end addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for s, _ in pairs( aSavePlaces ) do for _, a in pairs( aSavePlaces[ s ] ) do pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) setElementData( pColshape, 'zombieProof', true ) addEventHandler ( 'onColShapeHit', pColshape, enter ) addEventHandler ( 'onColShapeLeave', pColshape, function ( pLeaveElement ) if getElementType( pLeaveElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pLeaveElement, 'fire', true ) toggleControl ( pLeaveElement, 'aim_weapon', true ) toggleControl ( pLeaveElement, 'vehicle_fire', true ) end if not bUseRunInSaveZone then toggleControl ( pLeaveElement, 'sprint', true ) end if not bUseJumpInSaveZone then toggleControl ( pLeaveElement, 'jump', true ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'weapon', true ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'ammo', true ) end if not bUseDamageInSaveZone then setElementData( pLeaveElement, 'damage', 'yes' ) end elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it killPed( pLeaveElement ) -- kill ped end end ) end end if bUseRadarArea then for _, a in ipairs( aRadarAreaPlaces ) do pRadarArea = createRadarArea ( unpack( a ) ) end end end ) Link to comment
Narutimmy Posted April 10, 2013 Author Share Posted April 10, 2013 Intenta si te funciona asi: -- Advanced Anti Zombie by Kenix version 1.0.6 --[[ It's example how use it. Change this ]] local aSavePlaces = { Rectangle = { -- X, Y, Width, Height { -3000.1, 2100.1, 800, 800 }; { -250, -150, 500, 300 }; }; } local aRadarAreaPlaces = { -- x, y ,size 1, size 2, color: red, green, blue, alpha. { -3000.1, 2100.1, 800, 800, 0, 255, 0, 100 }; { -250, -150, 500, 300, 0, 255, 0, 100 }; } local sResourceName = getResourceName ( resource ) local bUseGunsInSavePlace = get( sResourceName .. '.UseGunsInSaveZone' ) local bUseRadarArea = get( sResourceName .. '.UseRadarArea' ) local pColshape, pRadarArea local bUseRunInSaveZone = get( sResourceName .. '.UseRunInSaveZone' ) local bUseJumpInSaveZone = get( sResourceName .. '.UseJumpInSaveZone' ) local bUseWeaponHudInSaveZone = get( sResourceName .. '.UseWeaponHudInSaveZone' ) local bUseAmmoHudInSaveZone = get( sResourceName .. '.UseAmmoHudInSaveZone' ) local bUseDamageInSaveZone = get( sResourceName .. '.UseDamageInSaveZone' ) function enter( pHitElement ) if isElementWithinColShape ( pHitElement, pColshape ) then if getElementType( pHitElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pHitElement, 'fire', false ) toggleControl ( pHitElement, 'aim_weapon', false ) toggleControl ( pHitElement, 'vehicle_fire', false ) end if not bUseRunInSaveZone then toggleControl ( pHitElement, 'sprint', false ) end if not bUseJumpInSaveZone then toggleControl ( pHitElement, 'jump', false ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pHitElement, 'weapon', false ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pHitElement, 'ammo', false ) end if not bUseDamageInSaveZone then setElementData( pHitElement, 'damage', 'no' ) end elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it killPed( pHitElement ) -- kill ped end end end addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for s, _ in pairs( aSavePlaces ) do for _, a in pairs( aSavePlaces[ s ] ) do pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) setElementData( pColshape, 'zombieProof', true ) addEventHandler ( 'onColShapeHit', pColshape, enter ) addEventHandler ( 'onColShapeLeave', pColshape, function ( pLeaveElement ) if getElementType( pLeaveElement ) == 'player' then if not bUseGunsInSavePlace then toggleControl ( pLeaveElement, 'fire', true ) toggleControl ( pLeaveElement, 'aim_weapon', true ) toggleControl ( pLeaveElement, 'vehicle_fire', true ) end if not bUseRunInSaveZone then toggleControl ( pLeaveElement, 'sprint', true ) end if not bUseJumpInSaveZone then toggleControl ( pLeaveElement, 'jump', true ) end if not bUseWeaponHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'weapon', true ) end if not bUseAmmoHudInSaveZone then showPlayerHudComponent ( pLeaveElement, 'ammo', true ) end if not bUseDamageInSaveZone then setElementData( pLeaveElement, 'damage', 'yes' ) end elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it killPed( pLeaveElement ) -- kill ped end end ) end end if bUseRadarArea then for _, a in ipairs( aRadarAreaPlaces ) do pRadarArea = createRadarArea ( unpack( a ) ) end end end ) No funciona , de echo asi incluso los zombis aparecen. Link to comment
Recommended Posts