Banex Posted December 13, 2014 Posted December 13, 2014 I have seen that some variables in OOP are equal, such as these functions: https://wiki.multitheftauto.com/wiki/IsPlayerMuted https://wiki.multitheftauto.com/wiki/SetPlayerMuted I do not understand how this will work. Could someone explain to me please?
DiSaMe Posted December 13, 2014 Posted December 13, 2014 object:method(arg1, arg2, ...) Is the same as object.method(object, arg1, arg2, ...) Therefore player:setMuted(muted) Is the same as setPlayerMuted(player, muted)
Banex Posted December 13, 2014 Author Posted December 13, 2014 I do not understand how to use the variable, the two functions have the same variable, so if I use the variable of isPlayerMuted function, player.muted() without putting any argument as to whether the player is muted or not, I'll have a warning message in debugscript not to use the obligatory argument setPlayerMuted function?
MTA Team botder Posted December 13, 2014 MTA Team Posted December 13, 2014 It should work like this (not sure) local player = Player.getRandom() -- Mute the player player:setMuted(true) player.muted = true setPlayerMuted(player, true) -- Unmute the player player:setMuted(false) player.muted = false setPlayerMuted(player, false) -- Is the player muted? if player.muted then --[[ ... ]] end if player:isMuted() then --[[ ... ]] end if isPlayerMuted(player) then --[[ ... ]] end
Banex Posted December 13, 2014 Author Posted December 13, 2014 I did a test, and now I understand if I do not give any value to function then it will work as the pair function. Thanks to all
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now