Banex Posted December 13, 2014 Share 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? Link to comment
DiSaMe Posted December 13, 2014 Share 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) Link to comment
Banex Posted December 13, 2014 Author Share 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? Link to comment
MTA Team botder Posted December 13, 2014 MTA Team Share 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 Link to comment
Banex Posted December 13, 2014 Author Share 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 Link to comment
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