IsBan: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
{{New items| | {{New items|3.014|1.4| | ||
This function checks | This function checks whether the passed value is valid [[ban]] or not. | ||
}} | }} | ||
Line 12: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''theBan:''' The value to check | ||
===Returns=== | ===Returns=== |
Revision as of 13:28, 24 November 2015
This function checks whether the passed value is valid ban or not.
Syntax
bool isBan ( ban theBan )
Required Arguments
- theBan: The value to check
Returns
Returns true if the value is a ban, false otherwise.
Example
Click to collapse [-]
Example1This example chechks if the passed argument is a ban or not.
function banRecieve ( ban ) if ban and isBan(ban) == true then outputChatBox("this is a ban!")--Valid ban is recieved! else outputChatBox("this is not a ban, this is a "..getElementType(ban))--if the argument is not a ban, then checks its type and output it into the chat box. end end function onBan ( ban ) -- This function will be triggered every time a player is banned. banRecieve(ban) end addEventHandler ( "onPlayerBan", getRootElement(), onBan ) function sendWrongBanArguement() vehicle = createVehicle(411,0,5,3) object = createObject(2600,0,0,0) ped = createPed(61,0,0,3) banRecieve(vehicle)--sends a vehicle as an argument. banRecieve(object)--sends an object as an argument. banRecieve(ped)--sends a ped as an argument. end addCommandHandler("sendWrongArgument",sendWrongBanArguement)