SetBanNick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added oop syntax)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{Needs Example}}


{{New feature/item|3.0141|1.4.1|7093|This function sets a new nick for a [[ban]].}}
{{New feature/item|3.0141|1.4.1|7093|This function sets a new nick for a [[ban]].}}
Line 7: Line 6:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setBanNick ( ban theBan, string theNick )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setBanNick ( ban theBan, string theNick )</syntaxhighlight>
{{OOP||[[ban]]:setNick|nick|getBanNick}}


===Required Arguments===  
===Required Arguments===  
Line 17: Line 18:
== Example ==
== Example ==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- this example looks if there is a ban with nick 'Steve', and if is, it changes ban nick to 'Mike'
-- this example looks if there is a ban with nick 'Steve', and if there is, it changes ban nick to 'Mike'
function changeBanNick()
function changeBanNick()
   for i,ban in pairs(getBans()) do
   for i,ban in pairs(getBans()) do

Latest revision as of 15:22, 6 August 2016

This function sets a new nick for a ban.

Syntax

bool setBanNick ( ban theBan, string theNick )


OOP Syntax Help! I don't understand this!

Method: ban:setNick(...)
Variable: .nick
Counterpart: getBanNick


Required Arguments

  • theBan: The ban you want to change the nick of.
  • theNick: A string representing the nick you want to set the ban to.

Returns

Returns true if changed, false otherwise.

Example

-- this example looks if there is a ban with nick 'Steve', and if there is, it changes ban nick to 'Mike'
function changeBanNick()
   for i,ban in pairs(getBans()) do
      if getBanNick(ban) == "Steve" then
         setBanNick(ban,"Mike")
      end
   end
end
addCommandHandler("setbannick",changeBanNick)

See Also