Chessnut / NSPlugins

A collection for NutScript plugins.
11 stars 19 forks source link

Flashlight Plugin #2

Closed Ameno-Sagiri closed 10 years ago

Ameno-Sagiri commented 10 years ago

The flashlight item does nothing.

When you have it in your inventory, you cannot turn your flashlight on.

Same as not having one in your inventory.

I have -- Whether or not players can use the flashlight. nut.config.flashlight = true

set in NutScript's sv_config.lua, does this need to be changed? I tried it both ways and there was no difference.

No-Half-Measures commented 10 years ago

A Fix: sh_plugin.lua

function PLUGIN:PlayerSwitchFlashlight(client, state)
        if (state and !client:HasItem("flashlight")) then
                return false
        end
        return true
end

Chessnut missed out returning True if they do have a flashlight so it was just blocking it no matter what.