StopResource native

https://runtime.fivem.net/doc/natives/?_0x21783161

I want to use native on server side to stop the same resource:

StopResource(GetCurrentResourceName())

But its not triggering it can someone help me!

You can’t use StopResource to stop itself.

What can i do then ?

Use another resource to stop it.

So there is no chance to stop it itself?

Resources can’t stop themselves. You can create a resource to stop another resource. That’s all. However, I still don’t see the interest of stopping the resource by itself, what are you trying to achieve?

AddEventHandler('onResourceStart', function()

    if (GetCurrentResourceName() == "my_script") then

        print('working')

    else
       StopResource(GetCurrentResourceName())
        print('notworking')

    end

end)

moi personnelement un menu que l’on ne peut ouvrir qu’une fois