Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make method MP:IsPlayerPrivileged(pl) better #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
13 changes: 8 additions & 5 deletions lua/mediaplayer/players/base/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function MEDIAPLAYER:OnPlayerStateChanged( old, new )
local validMedia = IsValid(media)

if MediaPlayer.DEBUG then
print( "MEDIAPLAYER.OnPlayerStateChanged", old .. ' => ' .. new )
print( "MEDIAPLAYER.OnPlayerStateChanged", old .. " => " .. new )
end

if new == MP_STATE_PLAYING then
Expand Down Expand Up @@ -176,8 +176,11 @@ end
-- etc.). Override this for custom behavior.
--
function MEDIAPLAYER:IsPlayerPrivileged( ply )
return ply == self:GetOwner() or ply:IsAdmin() or
hook.Run( "MediaPlayerIsPlayerPrivileged", self, ply )
if ply == self:GetOwner() or ply:IsAdmin() then
return true
end

return hook.Run("MediaPlayerIsPlayerPrivileged", ply, self) or false
end

---
Expand Down Expand Up @@ -389,7 +392,7 @@ function MEDIAPLAYER:OnMediaStarted( media )
self:SetPlayerState( MP_STATE_PLAYING )
end

self:emit('mediaStarted', media)
self:emit("mediaStarted", media)

elseif SERVER then
self:SetPlayerState( MP_STATE_ENDED )
Expand Down Expand Up @@ -421,7 +424,7 @@ function MEDIAPLAYER:OnMediaFinished( media )
media:Stop()
end

self:emit('mediaFinished', media)
self:emit("mediaFinished", media)

if SERVER then
if media and self:GetQueueRepeat() then
Expand Down