UScript for Unturned uScript2 Official Documentation

From Free Knowledge Base- The DUCK Project
Revision as of 09:46, 1 February 2025 by Littleguy (talk | contribs)
Jump to navigation Jump to search

This is a duplication of what is available on the uScript discord server. Download the latest (uScript_v2.0.5_Documentation.zip at the time of this writing) from Discord. uScript2 was created by Ster. Documentation last known release date: — 4/28/23, 1:15 PM

Event: onAccuracyUpdated(player)
Event: onAid(player, target, item, *cancel)
Event: onAnimalKilled(player)
Event: onArenaWin(player)
Event: onBarricadeBuild(player, id, position, *cancel)
Event: onBarricadeDestroy(player, barricade, *cancel)
Event: onClothingUpdated(player, item, slot)
Event: onConsume(player, item, *cancel)
Event: onEffectButtonClicked(player, buttonName)
Event: onEffectTextCommitted(player, buttonName, text)
Event: onFishCaught(player)
Event: onHeadShot(player)
Event: onInterval(timeInSeconds) NOTE: You should replace timeInSeconds without the number of seconds you want between each interval
Event: onLoad()
Event: onMegaZombieKilled(player)
Event: onPlantHarvested(player)
Event: onPlayerChatted(player, message, mode, *color, *cancel)
Event: onPlayerCrafted(player, itemId, *cancel)
Event: onPlayerDamaged(victim, killer, *cancel, *damage, cause, limb)
Event: onPlayerDeath(victim, killer, cause)
Event: onPlayerEquipped(player, item, *cancel)
Event: onPlayerExperienceUpdated(player)
Event: onPlayerGestured(player, gesture)
Event: onPlayerInventoryAdded(player, item)
Event: onPlayerInventoryRemoved(player, item)
Event: onPlayerJoined(player)
Event: onPlayerQuit(player)
Event: onPlayerRespawned(player)
Event: onRockMined(player)
Event: onSignModify(player, sign, *text, *cancel)
Event: onStructureBuild(player, id, position, *cancel)
Event: onStructureDestroy(player, structure, *cancel)
Event: onTreeChopped(player)
Event: onUnload()
Event: onVehicleDamaged(vehicle, player, cause, *damage, *cancel)
Event: onVehicleEnter(player, vehicle, *cancel)
Event: onVehicleExit(player, vehicle, *cancel)
Event: onZombieKilled(player)

Globals:
    +print(object... arguments)
    +array(object... arguments) : object [DEPRECATED]
    +broadcast(object message, [string chatColor], [string url])
    +isPlayer(object obj) : boolean [DEPRECATED]
    +isSet(object obj) : boolean [DEPRECATED]
    +toPlayer(string name_OR_id) : player

Array [Base Type]:
    +add(object item)
    +clear()
    +contains(object item) : boolean
    +indexOf(object item) : int32
    +insert(int32 index, object item)
    +join(string separator) : string
    +lastIndexOf(object item) : int32
    +range(int32 startIndex, int32 count) : object
    +remove(object item) : object
    +removeAt(int32 index)
    +skip(int32 count) : object
    +sort()
    +sort(int32 index, int32 count)
    +sortDesc()
    +sortDesc(int32 index, int32 count)
    +count               [get]      : int32

barricade [Class]:
    +damage(uInt16 amount)
    +destroy()
    +repair(uInt16 amount)
    +door                [get]      : door
    +health              [get]      : uInt16
    +id                  [get]      : uInt16
    +instanceId          [get]      : uInt32
    +itemType            [get]      : string
    +group               [get/set]  : string
    +maxHealth           [get]      : uInt16
    +name                [get]      : string
    +owner               [get/set]  : string
    +position            [get]      : vector3
    +sign                [get]      : sign
    +storage             [get]      : storage

database [Static Class]:
    +escape(string text) : string
    +execute(string query) : object
    +allRows(string query, object... prepareArgs) : object
    +firstRow(string query, object... prepareArgs) : object
    +scalar(string query, object... prepareArgs) : object
    +nonQuery(string query, object... prepareArgs)

dateTime [Class]:
    Constructor: dateTime(int32 year, int32 month, int32 day, int32 hour, int32 minute, int32 second, int32 millisecond)
    +toString([format]) : string
    +date                [get]      : string
    +time                [get]      : string
    +year                [get]      : int32
    +month               [get]      : int32
    +day                 [get]      : int32
    +hour                [get]      : int32
    +minute              [get]      : int32
    +second              [get]      : int32
    +millisecond         [get]      : int32
    +totalDays           [get]      : double
    +totalHours          [get]      : double
    +totalMinutes        [get]      : double
    +totalSeconds        [get]      : double
    +totalMilliseconds   [get]      : double

discordEmbed [Class]:
    Constructor: discordEmbed()
    Constructor: discordEmbed(string title, string description)
    +title               [get/set]  : string
    +description         [get/set]  : string
    +url                 [get/set]  : string
    +color               [get/set]  : int32
    +footer              [get/set]  : embedFooter
    +image               [get/set]  : embedImage
    +video               [get/set]  : embedVideo
    +author              [get/set]  : embedAuthor

discord [Static Class]:
    +send(string content, string webhookUrl, [string userName], [string avatarUrl])
    +sendEmbed(string webhookUrl, discordEmbed embed)

door [Class]:
    +close()
    +open()
    +toggle()
    +barricade           [get]      : barricade
    +isOpen              [get]      : boolean

effectManager [Static Class]:
    +clearUIById(uInt16 id, string steamId)
    +sendUI(uInt16 id, int16 key, string steamId, [object arg0], [object arg1], [object arg2], [object arg3])

embedAuthor [Class]:
    +name                [get/set]  : string
    +iconUrl             [get/set]  : string

embedFooter [Class]:
    +text                [get/set]  : string
    +iconUrl             [get/set]  : string

embedImage [Class]:

embedVideo [Class]:

file [Static Class]:
    +append(string path, string text)
    +appendLine(string path, string text)
    +read(string path) : string
    +writeAll(string path, string text)

Function [Base Type]:
    +Name                [get]      : object

gameGroup [Class]:
    Constructor: gameGroup(string name)
    +assign(player player) : boolean
    +cancelInvite(player player) : boolean
    +getRank(player player) : string
    +invite(player player) : boolean
    +kick(player player, [boolean force]) : boolean
    +setRank(player player, string rank) : boolean
    +id                  [get]      : string
    +memberCount         [get]      : number
    +name                [get/set]  : string
    +onlineMembers       [get]      : object

inventory [Class]:
    +addItem(uInt16 id) : boolean
    +hasItem(uInt16 id) : boolean
    +removeItem(uInt16 id) : boolean
    +items               [get]      : object

item [Class]:
    +id                  [get]      : uInt16
    +itemType            [get]      : string
    +name                [get]      : string

keyValuePair [Class]:
    +key                 [get/set]  : object
    +value               [get/set]  : object

logger [Static Class]:
    +log(string message)

marker [Class]:
    +set(vector3 position, [string text])
    +remove()
    +isSet               [get]      : boolean
    +position            [get/set]  : vector3
    +text                [get/set]  : string

map [Class]:
    Constructor: map()
    +clear()
    +containsKey(object key) : boolean
    +containsValue(object value) : boolean
    +get(object key) : object
    +set(object key, object value)
    +remove(object key) : boolean
    +count               [get]      : int32
    +keys                [get]      : object
    +values              [get]      : object

math [Static Class]:
    +abs(double value) : double
    +acos(double d) : double
    +asin(double d) : double
    +atan(double d) : double
    +ceiling(double d) : double
    +cos(double d) : double
    +exp(double d) : double
    +floor(double d) : double
    +log(double d) : double
    +max(double x, double y) : double
    +min(double x, double y) : double
    +round(double d) : double
    +sign(double d) : double
    +sin(double d) : double
    +sqrt(double d) : double
    +tan(double d) : double
    +truncate(double d) : double
    +pi                  [get]      : double

Number [Base Type]:
    +isInt() : boolean

Object [Base Type]:
    +add(object key, object value)
    +clear()
    +containsKey(object key) : boolean
    +containsValue(object value) : boolean
    +get(object key) : object
    +remove(object key) : boolean
    +length              [get]      : int32

player [Class]:
    +addGroup(string groupId)
    +arrest()
    +assignToMainGroup()
    +ban([string reason], [uInt32 duration], [boolean shouldBanIP])
    +browserRequest(string message, string url)
    +damage(single amount)
    +getData(string key) : object
    +getFlag(uInt16 key) : int16