Jump to content

Convertir client en server


Bossy

Recommended Posts

Posted (edited)

 

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
Posted
3 minutes ago, NeXuS™ said:

You'l have to use custom events and then trigger them from the server-side.

 

If I use triggerclientvent you think it will look server side

Posted

You'll need to make the script server-sided, edit it so it works fine and then create the effects on client-side, make a custom event on client-side and then trigger that event from server-side.

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...