Jump to content

Help for triggering event


MisaFix

Recommended Posts

51 minutes ago, The_GTA said:

Hello MisaFix,

it would be helpful if you could share the code that you have already made. This question appears to be complicated.

I couldn't even write the code carefully. This is the code im trying to attach to a event.

 

function toggleFlashLight()
if flashLiTable.flModel[localPlayer] then
    triggerServerEvent("onSwitchLight", resourceRoot, false)
    triggerServerEvent("onSwitchEffect", resourceRoot, false)
    isLightOn = false
    unbindKey(switch_key,"down",toggleLight)
else
    triggerServerEvent("onSwitchLight", resourceRoot, false)
    triggerServerEvent("onSwitchEffect", resourceRoot, true)
    bindKey(switch_key,"down",toggleLight)
    end
end


addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource()), function()
    engineImportTXD( engineLoadTXD( "objects/flashlight.txd" ), objID )
    engineReplaceModel ( engineLoadDFF( "objects/flashlight.dff", 0 ), objID,true)
    triggerServerEvent("onPlayerStartRes", resourceRoot)
    if autoEnableFL then
        toggleFlashLight()
    end
    addCommandHandler("fener", toggleFlashLight)
    exports.dynamic_lighting:setWorldNormalShading(false)
end
)
Link to comment
1 minute ago, The_GTA said:

I see. You can retrieve the model of the localPlayer element by calling getElementModel. The element model of the player is also called the "skin ID". Then you can check that it matches your model number, for instance 66.

How am I going to do it? Can anyone send me the code please? I need it. Thank you.

Link to comment
  • IIYAMA locked this topic
  • Moderators
16 minutes ago, MisaFix said:

Can anyone send me the code please? I need it.

Please read the section guidelines before posting.

Section guidlines

Quote

The Scripting section is not meant for those unwilling to learn, whose only intent is to try get others to finish the scripts they need, line by line.

 

Topic locked

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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