MisaFix Posted December 23, 2021 Share Posted December 23, 2021 Hello. I'm using this flashlight script: https://community.multitheftauto.com/index.php?p=resources&s=details&id=6858 Im trying to trigger the toggleFlashLight() when the player changes his skin to 66. But i couldn't make it. So basically, when the user has the skin ID 66, the toggleFlashLight() function will happen. I'd love to get some help. Link to comment
The_GTA Posted December 23, 2021 Share Posted December 23, 2021 Hello MisaFix, it would be helpful if you could share the code that you have already made. This question appears to be complicated. Link to comment
MisaFix Posted December 23, 2021 Author Share Posted December 23, 2021 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
The_GTA Posted December 23, 2021 Share Posted December 23, 2021 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. 1 Link to comment
MisaFix Posted December 23, 2021 Author Share Posted December 23, 2021 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
Moderators IIYAMA Posted December 23, 2021 Moderators Share Posted December 23, 2021 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
Recommended Posts