Jump to content

Convertir client en server


MYSOTO

Recommended Posts

 

Hi believe this rs what happens is that the effects are only seen on the side of the user osea client and the others can not see it I would like to help me to turn it server side

 
 

 x, y, z = getElementPosition(player)
 fx2 = createEffect("flame", x, y, z-1000)
 fx3 = createEffect("flame", x, y, z-1000)
 fx4 = createEffect("flame", x, y, z-1000)
function fire()
    setEffectDensity(fx2, 2)
    setEffectSpeed(fx2, 1)
    setObjectScale ( fx2, 0.5)
    attachElements (fx,localPlayer, 0, 0, 5 )
    setWeaponProperty(8, "damage", 100)

end
addCommandHandler("fire", fire)


function disableMinigunOnSwitch ( player, prevSlot, newSlot )
    if getPedWeapon(player(),newSlot) == 8 then --if the switched weapon is the minigun
            exports.bone_attach:attachElementToBone(fx2,player,12,0,0,0.1,0,0,0)
            exports.bone_attach:attachElementToBone(fx3,player,12,-1,0,0.1,0,0,0)
            exports.bone_attach:attachElementToBone(fx4,player,12,-0.5,0,0.1,0,0,0)
    else --if it isnt the minigun
        exports.bone_attach:detachElementFromBone(fx) 
        exports.bone_attach:detachElementFromBone(fx2) 
        exports.bone_attach:detachElementFromBone(fx3) 
        exports.bone_attach:detachElementFromBone(fx4)
        setElementPosition ( fx2, x, y, z-1000 )
        setElementPosition ( fx3, x, y, z-1000 )
        setElementPosition ( fx4, x, y, z-1000 )
        
    end
end
addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), disableMinigunOnSwitch )

function stopMinigunDamage ( attacker, weapon, bodypart )
    if ( weapon == 8 ) then --if the weapon used was the minigun
        createFire(x, y, z, 2) --cancel the event
    end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )

 

Edited by MystoganScripter
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...