Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ function InitHooks(a_Plugin)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, OnPlayerSpawned)
cPluginManager:AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_TOSSING_ITEM,OnPlayerTossingItem)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this a tab and make sure OnPlayerTossingItem aligns with the other hooks? If the hook gets so long that you can't add a space after the comma you can add one space to the other hooks.


end


Expand Down Expand Up @@ -230,6 +232,17 @@ function OnWorldTick(a_World, a_TimeDelta)
)
end




function OnPlayerTossingItem(a_Player)
local PlayerState = GetPlayerState(a_Player)
if (PlayerState:IsLoggedIn()) then
return false
end

a_Player:SendMessage(
cCompositeChat()
:AddTextPart("Please use ")
:AddSuggestCommandPart("/login", "/login", "u")
:AddTextPart(" first.")
)
return true
end