UScript for Unturned uScript2 Official Documentation: Difference between revisions

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
Created page with "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...."
 
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
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
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
<nowiki>Event: onAccuracyUpdated(player)</nowiki>
<nowiki>Event: onAid(player, target, item, *cancel)</nowiki>
<nowiki>Event: onAnimalKilled(player)</nowiki>
<nowiki>Event: onArenaWin(player)</nowiki>
<nowiki>Event: onBarricadeBuild(player, id, position, *cancel)</nowiki>
<nowiki>Event: onBarricadeDestroy(player, barricade, *cancel)</nowiki>
<nowiki>Event: onClothingUpdated(player, item, slot)</nowiki>
<nowiki>Event: onConsume(player, item, *cancel)</nowiki>
<nowiki>Event: onEffectButtonClicked(player, buttonName)</nowiki>
<nowiki>Event: onEffectTextCommitted(player, buttonName, text)</nowiki>
<nowiki>Event: onFishCaught(player)</nowiki>
<nowiki>Event: onHeadShot(player)</nowiki>
<nowiki>Event: onInterval(timeInSeconds) NOTE: You should replace timeInSeconds without the number of seconds you want between each interval</nowiki>
<nowiki>Event: onLoad()</nowiki>
<nowiki>Event: onMegaZombieKilled(player)</nowiki>
<nowiki>Event: onPlantHarvested(player)</nowiki>
<nowiki>Event: onPlayerChatted(player, message, mode, *color, *cancel)</nowiki>
<nowiki>Event: onPlayerCrafted(player, itemId, *cancel)</nowiki>
<nowiki>Event: onPlayerDamaged(victim, killer, *cancel, *damage, cause, limb)</nowiki>
<nowiki>Event: onPlayerDeath(victim, killer, cause)</nowiki>
<nowiki>Event: onPlayerEquipped(player, item, *cancel)</nowiki>
<nowiki>Event: onPlayerExperienceUpdated(player)</nowiki>
<nowiki>Event: onPlayerGestured(player, gesture)</nowiki>
<nowiki>Event: onPlayerInventoryAdded(player, item)</nowiki>
<nowiki>Event: onPlayerInventoryRemoved(player, item)</nowiki>
<nowiki>Event: onPlayerJoined(player)</nowiki>
<nowiki>Event: onPlayerQuit(player)</nowiki>
<nowiki>Event: onPlayerRespawned(player)</nowiki>
<nowiki>Event: onRockMined(player)</nowiki>
<nowiki>Event: onSignModify(player, sign, *text, *cancel)</nowiki>
<nowiki>Event: onStructureBuild(player, id, position, *cancel)</nowiki>
<nowiki>Event: onStructureDestroy(player, structure, *cancel)</nowiki>
<nowiki>Event: onTreeChopped(player)</nowiki>
<nowiki>Event: onUnload()</nowiki>
<nowiki>Event: onVehicleDamaged(vehicle, player, cause, *damage, *cancel)</nowiki>
<nowiki>Event: onVehicleEnter(player, vehicle, *cancel)</nowiki>
<nowiki>Event: onVehicleExit(player, vehicle, *cancel)</nowiki>
<nowiki>Event: onZombieKilled(player)</nowiki>
<nowiki></nowiki>
<nowiki>Globals:</nowiki>
<nowiki>    +print(object... arguments)</nowiki>
<nowiki>    +array(object... arguments) : object [DEPRECATED]</nowiki>
<nowiki>    +broadcast(object message, [string chatColor], [string url])</nowiki>
<nowiki>    +isPlayer(object obj) : boolean [DEPRECATED]</nowiki>
<nowiki>    +isSet(object obj) : boolean [DEPRECATED]</nowiki>
<nowiki>    +toPlayer(string name_OR_id) : player</nowiki>
<nowiki></nowiki>
<nowiki>Array [Base Type]:</nowiki>
<nowiki>    +add(object item)</nowiki>
<nowiki>    +clear()</nowiki>
<nowiki>    +contains(object item) : boolean</nowiki>
<nowiki>    +indexOf(object item) : int32</nowiki>
<nowiki>    +insert(int32 index, object item)</nowiki>
<nowiki>    +join(string separator) : string</nowiki>
<nowiki>    +lastIndexOf(object item) : int32</nowiki>
<nowiki>    +range(int32 startIndex, int32 count) : object</nowiki>
<nowiki>    +remove(object item) : object</nowiki>
<nowiki>    +removeAt(int32 index)</nowiki>
<nowiki>    +skip(int32 count) : object</nowiki>
<nowiki>    +sort()</nowiki>
<nowiki>    +sort(int32 index, int32 count)</nowiki>
<nowiki>    +sortDesc()</nowiki>
<nowiki>    +sortDesc(int32 index, int32 count)</nowiki>
<nowiki>    +count              [get]      : int32</nowiki>
<nowiki></nowiki>
<nowiki>barricade [Class]:</nowiki>
<nowiki>    +damage(uInt16 amount)</nowiki>
<nowiki>    +destroy()</nowiki>
<nowiki>    +repair(uInt16 amount)</nowiki>
<nowiki>    +door                [get]      : door</nowiki>
<nowiki>    +health              [get]      : uInt16</nowiki>
<nowiki>    +id                  [get]      : uInt16</nowiki>
<nowiki>    +instanceId          [get]      : uInt32</nowiki>
<nowiki>    +itemType            [get]      : string</nowiki>
<nowiki>    +group              [get/set]  : string</nowiki>
<nowiki>    +maxHealth          [get]      : uInt16</nowiki>
<nowiki>    +name                [get]      : string</nowiki>
<nowiki>    +owner              [get/set]  : string</nowiki>
<nowiki>    +position            [get]      : vector3</nowiki>
<nowiki>    +sign                [get]      : sign</nowiki>
<nowiki>    +storage            [get]      : storage</nowiki>
<nowiki></nowiki>
<nowiki>database [Static Class]:</nowiki>
<nowiki>    +escape(string text) : string</nowiki>
<nowiki>    +execute(string query) : object</nowiki>
<nowiki>    +allRows(string query, object... prepareArgs) : object</nowiki>
<nowiki>    +firstRow(string query, object... prepareArgs) : object</nowiki>
<nowiki>    +scalar(string query, object... prepareArgs) : object</nowiki>
<nowiki>    +nonQuery(string query, object... prepareArgs)</nowiki>
<nowiki></nowiki>
<nowiki>dateTime [Class]:</nowiki>
<nowiki>    Constructor: dateTime(int32 year, int32 month, int32 day, int32 hour, int32 minute, int32 second, int32 millisecond)</nowiki>
<nowiki>    +toString([format]) : string</nowiki>
<nowiki>    +date                [get]      : string</nowiki>
<nowiki>    +time                [get]      : string</nowiki>
<nowiki>    +year                [get]      : int32</nowiki>
<nowiki>    +month              [get]      : int32</nowiki>
<nowiki>    +day                [get]      : int32</nowiki>
<nowiki>    +hour                [get]      : int32</nowiki>
<nowiki>    +minute              [get]      : int32</nowiki>
<nowiki>    +second              [get]      : int32</nowiki>
<nowiki>    +millisecond        [get]      : int32</nowiki>
<nowiki>    +totalDays          [get]      : double</nowiki>
<nowiki>    +totalHours          [get]      : double</nowiki>
<nowiki>    +totalMinutes        [get]      : double</nowiki>
<nowiki>    +totalSeconds        [get]      : double</nowiki>
<nowiki>    +totalMilliseconds  [get]      : double</nowiki>
<nowiki></nowiki>
<nowiki>discordEmbed [Class]:</nowiki>
<nowiki>    Constructor: discordEmbed()</nowiki>
<nowiki>    Constructor: discordEmbed(string title, string description)</nowiki>
<nowiki>    +title              [get/set]  : string</nowiki>
<nowiki>    +description        [get/set]  : string</nowiki>
<nowiki>    +url                [get/set]  : string</nowiki>
<nowiki>    +color              [get/set]  : int32</nowiki>
<nowiki>    +footer              [get/set]  : embedFooter</nowiki>
<nowiki>    +image              [get/set]  : embedImage</nowiki>
<nowiki>    +video              [get/set]  : embedVideo</nowiki>
<nowiki>    +author              [get/set]  : embedAuthor</nowiki>
<nowiki></nowiki>
<nowiki>discord [Static Class]:</nowiki>
<nowiki>    +send(string content, string webhookUrl, [string userName], [string avatarUrl])</nowiki>
<nowiki>    +sendEmbed(string webhookUrl, discordEmbed embed)</nowiki>
<nowiki></nowiki>
<nowiki>door [Class]:</nowiki>
<nowiki>    +close()</nowiki>
<nowiki>    +open()</nowiki>
<nowiki>    +toggle()</nowiki>
<nowiki>    +barricade          [get]      : barricade</nowiki>
<nowiki>    +isOpen              [get]      : boolean</nowiki>
<nowiki></nowiki>
<nowiki>effectManager [Static Class]:</nowiki>
<nowiki>    +clearUIById(uInt16 id, string steamId)</nowiki>
<nowiki>    +sendUI(uInt16 id, int16 key, string steamId, [object arg0], [object arg1], [object arg2], [object arg3])</nowiki>
<nowiki></nowiki>
<nowiki>embedAuthor [Class]:</nowiki>
<nowiki>    +name                [get/set]  : string</nowiki>
<nowiki>    +iconUrl            [get/set]  : string</nowiki>
<nowiki></nowiki>
<nowiki>embedFooter [Class]:</nowiki>
<nowiki>    +text                [get/set]  : string</nowiki>
<nowiki>    +iconUrl            [get/set]  : string</nowiki>
<nowiki></nowiki>
<nowiki>embedImage [Class]:</nowiki>
<nowiki></nowiki>
<nowiki>embedVideo [Class]:</nowiki>
<nowiki></nowiki>
<nowiki>file [Static Class]:</nowiki>
<nowiki>    +append(string path, string text)</nowiki>
<nowiki>    +appendLine(string path, string text)</nowiki>
<nowiki>    +read(string path) : string</nowiki>
<nowiki>    +writeAll(string path, string text)</nowiki>
<nowiki></nowiki>
<nowiki>Function [Base Type]:</nowiki>
<nowiki>    +Name                [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>gameGroup [Class]:</nowiki>
<nowiki>    Constructor: gameGroup(string name)</nowiki>
<nowiki>    +assign(player player) : boolean</nowiki>
<nowiki>    +cancelInvite(player player) : boolean</nowiki>
<nowiki>    +getRank(player player) : string</nowiki>
<nowiki>    +invite(player player) : boolean</nowiki>
<nowiki>    +kick(player player, [boolean force]) : boolean</nowiki>
<nowiki>    +setRank(player player, string rank) : boolean</nowiki>
<nowiki>    +id                  [get]      : string</nowiki>
<nowiki>    +memberCount        [get]      : number</nowiki>
<nowiki>    +name                [get/set]  : string</nowiki>
<nowiki>    +onlineMembers      [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>inventory [Class]:</nowiki>
<nowiki>    +addItem(uInt16 id) : boolean</nowiki>
<nowiki>    +hasItem(uInt16 id) : boolean</nowiki>
<nowiki>    +removeItem(uInt16 id) : boolean</nowiki>
<nowiki>    +items              [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>item [Class]:</nowiki>
<nowiki>    +id                  [get]      : uInt16</nowiki>
<nowiki>    +itemType            [get]      : string</nowiki>
<nowiki>    +name                [get]      : string</nowiki>
<nowiki></nowiki>
<nowiki>keyValuePair [Class]:</nowiki>
<nowiki>    +key                [get/set]  : object</nowiki>
<nowiki>    +value              [get/set]  : object</nowiki>
<nowiki></nowiki>
<nowiki>logger [Static Class]:</nowiki>
<nowiki>    +log(string message)</nowiki>
<nowiki></nowiki>
<nowiki>marker [Class]:</nowiki>
<nowiki>    +set(vector3 position, [string text])</nowiki>
<nowiki>    +remove()</nowiki>
<nowiki>    +isSet              [get]      : boolean</nowiki>
<nowiki>    +position            [get/set]  : vector3</nowiki>
<nowiki>    +text                [get/set]  : string</nowiki>
<nowiki></nowiki>
<nowiki>map [Class]:</nowiki>
<nowiki>    Constructor: map()</nowiki>
<nowiki>    +clear()</nowiki>
<nowiki>    +containsKey(object key) : boolean</nowiki>
<nowiki>    +containsValue(object value) : boolean</nowiki>
<nowiki>    +get(object key) : object</nowiki>
<nowiki>    +set(object key, object value)</nowiki>
<nowiki>    +remove(object key) : boolean</nowiki>
<nowiki>    +count              [get]      : int32</nowiki>
<nowiki>    +keys                [get]      : object</nowiki>
<nowiki>    +values              [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>math [Static Class]:</nowiki>
<nowiki>    +abs(double value) : double</nowiki>
<nowiki>    +acos(double d) : double</nowiki>
<nowiki>    +asin(double d) : double</nowiki>
<nowiki>    +atan(double d) : double</nowiki>
<nowiki>    +ceiling(double d) : double</nowiki>
<nowiki>    +cos(double d) : double</nowiki>
<nowiki>    +exp(double d) : double</nowiki>
<nowiki>    +floor(double d) : double</nowiki>
<nowiki>    +log(double d) : double</nowiki>
<nowiki>    +max(double x, double y) : double</nowiki>
<nowiki>    +min(double x, double y) : double</nowiki>
<nowiki>    +round(double d) : double</nowiki>
<nowiki>    +sign(double d) : double</nowiki>
<nowiki>    +sin(double d) : double</nowiki>
<nowiki>    +sqrt(double d) : double</nowiki>
<nowiki>    +tan(double d) : double</nowiki>
<nowiki>    +truncate(double d) : double</nowiki>
<nowiki>    +pi                  [get]      : double</nowiki>
<nowiki></nowiki>
<nowiki>Number [Base Type]:</nowiki>
<nowiki>    +isInt() : boolean</nowiki>
<nowiki></nowiki>
<nowiki>Object [Base Type]:</nowiki>
<nowiki>    +add(object key, object value)</nowiki>
<nowiki>    +clear()</nowiki>
<nowiki>    +containsKey(object key) : boolean</nowiki>
<nowiki>    +containsValue(object value) : boolean</nowiki>
<nowiki>    +get(object key) : object</nowiki>
<nowiki>    +remove(object key) : boolean</nowiki>
<nowiki>    +length              [get]      : int32</nowiki>
<nowiki></nowiki>
<nowiki>player [Class]:</nowiki>
<nowiki>    +addGroup(string groupId)</nowiki>
<nowiki>    +arrest()</nowiki>
<nowiki>    +assignToMainGroup()</nowiki>
<nowiki>    +ban([string reason], [uInt32 duration], [boolean shouldBanIP])</nowiki>
<nowiki>    +browserRequest(string message, string url)</nowiki>
<nowiki>    +damage(single amount)</nowiki>
<nowiki>    +getData(string key) : object</nowiki>
<nowiki>    +getFlag(uInt16 key) : int16</nowiki>
<nowiki>    +give(uInt16 itemId, [byte amount])</nowiki>
<nowiki>    +hasGroup(string groupName) : boolean</nowiki>
<nowiki>    +hasPermission(string permission) : boolean</nowiki>
<nowiki>    +heal()</nowiki>
<nowiki>    +kick([string reason])</nowiki>
<nowiki>    +kill()</nowiki>
<nowiki>    +maxSkills()</nowiki>
<nowiki>    +message(string message, [string chatColor], [string url])</nowiki>
<nowiki>    +release()</nowiki>
<nowiki>    +removeGroup(string groupId)</nowiki>
<nowiki>    +setData(string key, object value)</nowiki>
<nowiki>    +setFlag(uInt16 key, int16 value)</nowiki>
<nowiki>    +sudo(string command)</nowiki>
<nowiki>    +teleport(vector3 position)</nowiki>
<nowiki>    +teleport(double x, double y, double z)</nowiki>
<nowiki>    +arrested            [get]      : boolean</nowiki>
<nowiki>    +bedPosition        [get]      : vector3</nowiki>
<nowiki>    +bleeding            [get/set]  : boolean</nowiki>
<nowiki>    +broken              [get/set]  : boolean</nowiki>
<nowiki>    +clothing            [get]      : playerClothing</nowiki>
<nowiki>    +effects            [get]      : playerEffects</nowiki>
<nowiki>    +equipment          [get]      : playerEquipment</nowiki>
<nowiki>    +experience          [get/set]  : uInt32</nowiki>
<nowiki>    +food                [get/set]  : byte</nowiki>
<nowiki>    +gameGroup          [get]      : gameGroup</nowiki>
<nowiki>    +gesture            [get/set]  : string</nowiki>
<nowiki>    +god                [get/set]  : boolean</nowiki>
<nowiki>    +groups              [get]      : object</nowiki>
<nowiki>    +gravity            [get/set]  : single</nowiki>
<nowiki>    +hasBed              [get]      : boolean</nowiki>
<nowiki>    +health              [get/set]  : byte</nowiki>
<nowiki>    +hwid                [get]      : string</nowiki>
<nowiki>    +id                  [get]      : string</nowiki>
<nowiki>    +inventory          [get]      : playerInventory</nowiki>
<nowiki>    +ip                  [get]      : string</nowiki>
<nowiki>    +isAdmin            [get/set]  : boolean</nowiki>
<nowiki>    +isGold              [get]      : boolean</nowiki>
<nowiki>    +isInGameGroup      [get]      : boolean</nowiki>
<nowiki>    +isInMainGroup      [get]      : boolean</nowiki>
<nowiki>    +isInVehicle        [get]      : boolean</nowiki>
<nowiki>    +isMoving            [get]      : boolean</nowiki>
<nowiki>    +isTalking          [get]      : boolean</nowiki>
<nowiki>    +jumpAcceleration    [get/set]  : single</nowiki>
<nowiki>    +look                [get]      : playerLook</nowiki>
<nowiki>    +marker              [get]      : marker</nowiki>
<nowiki>    +name                [get/set]  : string</nowiki>
<nowiki>    +nearestLocation    [get]      : string</nowiki>
<nowiki>    +ping                [get]      : single</nowiki>
<nowiki>    +position            [get/set]  : vector3</nowiki>
<nowiki>    +radioFrequency      [get/set]  : uInt32</nowiki>
<nowiki>    +reputation          [get/set]  : int32</nowiki>
<nowiki>    +rotation            [get]      : single</nowiki>
<nowiki>    +steamGroup          [get/set]  : string</nowiki>
<nowiki>    +steamProfile        [get]      : playerSteamProfile</nowiki>
<nowiki>    +speed              [get/set]  : single</nowiki>
<nowiki>    +stance              [get/set]  : string</nowiki>
<nowiki>    +vanish              [get/set]  : boolean</nowiki>
<nowiki>    +virus              [get/set]  : byte</nowiki>
<nowiki>    +water              [get/set]  : byte</nowiki>
<nowiki>    +vehicle            [get]      : vehicle</nowiki>
<nowiki></nowiki>
<nowiki>playerClothing [Class]:</nowiki>
<nowiki>    +clear()</nowiki>
<nowiki>    +remove()</nowiki>
<nowiki>    +backpack            [get]      : item</nowiki>
<nowiki>    +glasses            [get]      : item</nowiki>
<nowiki>    +hat                [get]      : item</nowiki>
<nowiki>    +mask                [get]      : item</nowiki>
<nowiki>    +pants              [get]      : item</nowiki>
<nowiki>    +shirt              [get]      : item</nowiki>
<nowiki>    +vest                [get]      : item</nowiki>
<nowiki></nowiki>
<nowiki>playerEffects [Class]:</nowiki>
<nowiki>    +hideCursor()</nowiki>
<nowiki>    +clearUIById(uInt16 id)</nowiki>
<nowiki>    +sendUI(uInt16 id, int16 key, [object arg0], [object arg1], [object arg2], [object arg3])</nowiki>
<nowiki>    +sendUIText(int16 key, string childName, string text)</nowiki>
<nowiki>    +showCursor()</nowiki>
<nowiki></nowiki>
<nowiki>playerEquipment [Class]:</nowiki>
<nowiki>    +dequip()</nowiki>
<nowiki>    +item                [get]      : item</nowiki>
<nowiki></nowiki>
<nowiki>playerInventory [Class]:</nowiki>
<nowiki>    +addItem(uInt16 itemId, [byte amount])</nowiki>
<nowiki>    +clear()</nowiki>
<nowiki>    +hasItem(int32 itemId) : boolean</nowiki>
<nowiki>    +removeItem(uInt16 itemId, [byte amount])</nowiki>
<nowiki>    +isStoring          [get]      : boolean</nowiki>
<nowiki>    +items              [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>playerLook [Class]:</nowiki>
<nowiki>    +getBarricade() : barricade</nowiki>
<nowiki>    +getPlayer() : player</nowiki>
<nowiki>    +getPoint() : vector3</nowiki>
<nowiki>    +getStructure() : structure</nowiki>
<nowiki>    +getVehicle() : vehicle</nowiki>
<nowiki></nowiki>
<nowiki>playerSteamProfile [Class]:</nowiki>
<nowiki>    +avatarUrl          [get]      : string</nowiki>
<nowiki>    +created            [get]      : dateTime</nowiki>
<nowiki>    +name                [get]      : string</nowiki>
<nowiki>    +url                [get]      : string</nowiki>
<nowiki></nowiki>
<nowiki>random [Class]:</nowiki>
<nowiki>    Constructor: random()</nowiki>
<nowiki>    Constructor: random(int32 seed)</nowiki>
<nowiki>    +int() : int32</nowiki>
<nowiki>    +int(int32 maxValue) : int32</nowiki>
<nowiki>    +int(int32 minValue, int32 maxValue) : int32</nowiki>
<nowiki>    +double() : double</nowiki>
<nowiki></nowiki>
<nowiki>rocketGroup [Class]:</nowiki>
<nowiki>    +displayName        [get]      : string</nowiki>
<nowiki>    +id                  [get]      : string</nowiki>
<nowiki>    +prefix              [get]      : string</nowiki>
<nowiki>    +suffix              [get]      : string</nowiki>
<nowiki></nowiki>
<nowiki>server [Static Class]:</nowiki>
<nowiki>    +ban(string steamId, [string reason], [uInt32 duration], [boolean shouldBanIP]) : boolean</nowiki>
<nowiki>    +clearAllKeyValues()</nowiki>
<nowiki>    +execute(string command)</nowiki>
<nowiki>    +findBarricade(uInt32 instanceId) : barricade</nowiki>
<nowiki>    +findStructure(uInt32 instanceId) : structure</nowiki>
<nowiki>    +findVehicle(uInt32 instanceId) : vehicle</nowiki>
<nowiki>    +getBarricadesInRadius(vector3 position, single radius) : object</nowiki>
<nowiki>    +getGameGroup(string groupId) : gameGroup</nowiki>
<nowiki>    +getStructuresInRadius(vector3 position, single radius) : object</nowiki>
<nowiki>    +log(string message)</nowiki>
<nowiki>    +setBotPlayerCount(int32 numBots)</nowiki>
<nowiki>    +setGameData(string gameData)</nowiki>
<nowiki>    +setKeyValue(string key, string value)</nowiki>
<nowiki>    +unban(string steamId) : boolean</nowiki>
<nowiki>    +description        [get/set]  : string</nowiki>
<nowiki>    +ip                  [get]      : string</nowiki>
<nowiki>    +isDay              [get]      : boolean</nowiki>
<nowiki>    +isFullMoon          [get]      : boolean</nowiki>
<nowiki>    +isNight            [get]      : boolean</nowiki>
<nowiki>    +isRaining          [get]      : boolean</nowiki>
<nowiki>    +isSnowing          [get]      : boolean</nowiki>
<nowiki>    +map                [get/set]  : string</nowiki>
<nowiki>    +name                [get/set]  : string</nowiki>
<nowiki>    +players            [get]      : object</nowiki>
<nowiki>    +port                [get]      : uInt16</nowiki>
<nowiki>    +time                [get]      : uInt32</nowiki>
<nowiki>    +vehicles            [get]      : object</nowiki>
<nowiki></nowiki>
<nowiki>sign [Class]:</nowiki>
<nowiki>    +barricade          [get]      : barricade</nowiki>
<nowiki>    +text                [get/set]  : string</nowiki>
<nowiki></nowiki>
<nowiki>spawner [Static Class]:</nowiki>
<nowiki>    +spawnAnimal(uInt16 id, vector3 position, [single angle])</nowiki>
<nowiki>    +spawnBarricade(uInt16 id, vector3 position, [single angleX], [single angleY], [single angleZ], [string owner], [string group]) : barricade</nowiki>
<nowiki>    +spawnItem(uInt16 id, vector3 position, [boolean wideSpread])</nowiki>
<nowiki>    +spawnStructure(uInt16 id, vector3 position, [single angleX], [single angleY], [single angleZ], [string owner], [string group]) : structure</nowiki>
<nowiki>    +spawnVehicle(uInt16 id, vector3 position, [single angle]) : vehicle</nowiki>
<nowiki></nowiki>
<nowiki>stopwatch[Class]:</nowiki>
<nowiki>    Constructor: stopwatch()</nowiki>
<nowiki>    +reset()</nowiki>
<nowiki>    +start()</nowiki>
<nowiki>    +stop()</nowiki>
<nowiki>    +elapsedMilliseconds [get]      : number</nowiki>
<nowiki>    +elapsedSeconds      [get]      : number</nowiki>
<nowiki>    +elapsedTicks        [get]      : number</nowiki>
<nowiki></nowiki>
<nowiki>storage [Class]:</nowiki>
<nowiki>    +open(player player)</nowiki>
<nowiki>    +barricade          [get]      : barricade</nowiki>
<nowiki>    +inventory          [get]      : inventory</nowiki>
<nowiki>    +isOpen              [get]      : boolean</nowiki>
<nowiki></nowiki>
<nowiki>String [Base Type]:</nowiki>
<nowiki>    +charAt(int32 index) : string</nowiki>
<nowiki>    +charCodeAt(int32 index) : int32</nowiki>
<nowiki>    +contains(string value) : boolean</nowiki>
<nowiki>    +endsWith(string value) : boolean</nowiki>
<nowiki>    +indexOf(string value) : int32</nowiki>
<nowiki>    +insert(int32 index, string value) : string</nowiki>
<nowiki>    +lastIndexOf(string value) : int32</nowiki>
<nowiki>    +removeRich() : string</nowiki>
<nowiki>    +replace(string oldValue, string newValue) : string</nowiki>
<nowiki>    +split(string separator) : object</nowiki>
<nowiki>    +startsWith(string value) : boolean</nowiki>
<nowiki>    +substring(int32 startIndex) : string</nowiki>
<nowiki>    +substring(int32 startIndex, int32 length) : string</nowiki>
<nowiki>    +toNumber() : object</nowiki>
<nowiki>    +toUpper() : string</nowiki>
<nowiki>    +toLower() : string</nowiki>
<nowiki>    +trim() : string</nowiki>
<nowiki>    +format(object... arguments) : string</nowiki>
<nowiki>    +length              [get]      : int32</nowiki>
<nowiki></nowiki>
<nowiki>structure [Class]:</nowiki>
<nowiki>    +damage(uInt16 amount)</nowiki>
<nowiki>    +destroy()</nowiki>
<nowiki>    +repair(uInt16 amount)</nowiki>
<nowiki>    +health              [get]      : uInt16</nowiki>
<nowiki>    +id                  [get]      : uInt16</nowiki>
<nowiki>    +instanceId          [get]      : uInt32</nowiki>
<nowiki>    +group              [get/set]  : string</nowiki>
<nowiki>    +maxHealth          [get]      : uInt16</nowiki>
<nowiki>    +name                [get]      : string</nowiki>
<nowiki>    +owner              [get/set]  : string</nowiki>
<nowiki>    +position            [get]      : vector3</nowiki>
<nowiki></nowiki>
<nowiki>time [Static Class]:</nowiki>
<nowiki>    +now                [get]      : dateTime</nowiki>
<nowiki></nowiki>
<nowiki>Value [Base Type]:</nowiki>
<nowiki>    +toString() : string</nowiki>
<nowiki>    +type                [get]      : string</nowiki>
<nowiki></nowiki>
<nowiki>vector3 [Class]:</nowiki>
<nowiki>    Constructor: vector3(single x, single y, single z)</nowiki>
<nowiki>    +distance(vector3 other) : double</nowiki>
<nowiki>    +toString() : string</nowiki>
<nowiki>    +x                  [get/set]  : single</nowiki>
<nowiki>    +y                  [get/set]  : single</nowiki>
<nowiki>    +z                  [get/set]  : single</nowiki>
<nowiki></nowiki>
<nowiki>vehicle [Class]:</nowiki>
<nowiki>    +damage(uInt16 amount, boolean canRepair)</nowiki>
<nowiki>    +destroy()</nowiki>
<nowiki>    +explode()</nowiki>
<nowiki>    +popTires()</nowiki>
<nowiki>    +removePlayer(player player)</nowiki>
<nowiki>    +repair(uInt16 amount)</nowiki>
<nowiki>    +repairTires()</nowiki>
<nowiki>    +driver              [get]      : player</nowiki>
<nowiki>    +fuel                [get/set]  : uInt16</nowiki>
<nowiki>    +group              [get/set]  : string</nowiki>
<nowiki>    +health              [get/set]  : uInt16</nowiki>
<nowiki>    +id                  [get]      : uInt16</nowiki>
<nowiki>    +instanceId          [get]      : uInt32</nowiki>
<nowiki>    +inventory          [get]      : inventory</nowiki>
<nowiki>    +isDriven            [get]      : boolean</nowiki>
<nowiki>    +isLocked            [get/set]  : boolean</nowiki>
<nowiki>    +maxFuel            [get]      : uInt16</nowiki>
<nowiki>    +maxHealth          [get]      : uInt16</nowiki>
<nowiki>    +maxSpeed            [get]      : uInt16</nowiki>
<nowiki>    +minSpeed            [get]      : uInt16</nowiki>
<nowiki>    +name                [get]      : string</nowiki>
<nowiki>    +owner              [get/set]  : string</nowiki>
<nowiki>    +passengers          [get]      : object</nowiki>
<nowiki>    +position            [get]      : vector3</nowiki>
<nowiki>    +speed              [get]      : uInt16</nowiki>
<nowiki></nowiki>
<nowiki>wait [Static Class]:</nowiki>
<nowiki>    +seconds(single seconds, object function, object... arguments)</nowiki>
<nowiki></nowiki>
<nowiki>web [Static Class]:</nowiki>
<nowiki>    +get(string url) : string</nowiki>
<nowiki>    +getAsync(string url, object callbackFunction) : string</nowiki>
sarshane / uScript-EventsFixer
* [https://github.com/sarshane/uScript-EventsFixer/releases fixer2.0 Latest]
    Replaced broken .door with .getDoor()
    Fixed issues with callback things.
[[Category:Unturned]]
[[Category:uScript]]

Latest revision as of 10:52, 10 February 2025

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
    +give(uInt16 itemId, [byte amount])
    +hasGroup(string groupName) : boolean
    +hasPermission(string permission) : boolean
    +heal()
    +kick([string reason])
    +kill()
    +maxSkills()
    +message(string message, [string chatColor], [string url])
    +release()
    +removeGroup(string groupId)
    +setData(string key, object value)
    +setFlag(uInt16 key, int16 value)
    +sudo(string command)
    +teleport(vector3 position)
    +teleport(double x, double y, double z)
    +arrested            [get]      : boolean
    +bedPosition         [get]      : vector3
    +bleeding            [get/set]  : boolean
    +broken              [get/set]  : boolean
    +clothing            [get]      : playerClothing
    +effects             [get]      : playerEffects
    +equipment           [get]      : playerEquipment
    +experience          [get/set]  : uInt32
    +food                [get/set]  : byte
    +gameGroup           [get]      : gameGroup
    +gesture             [get/set]  : string
    +god                 [get/set]  : boolean
    +groups              [get]      : object
    +gravity             [get/set]  : single
    +hasBed              [get]      : boolean
    +health              [get/set]  : byte
    +hwid                [get]      : string
    +id                  [get]      : string
    +inventory           [get]      : playerInventory
    +ip                  [get]      : string
    +isAdmin             [get/set]  : boolean
    +isGold              [get]      : boolean
    +isInGameGroup       [get]      : boolean
    +isInMainGroup       [get]      : boolean
    +isInVehicle         [get]      : boolean
    +isMoving            [get]      : boolean
    +isTalking           [get]      : boolean
    +jumpAcceleration    [get/set]  : single
    +look                [get]      : playerLook
    +marker              [get]      : marker
    +name                [get/set]  : string
    +nearestLocation     [get]      : string
    +ping                [get]      : single
    +position            [get/set]  : vector3
    +radioFrequency      [get/set]  : uInt32
    +reputation          [get/set]  : int32
    +rotation            [get]      : single
    +steamGroup          [get/set]  : string
    +steamProfile        [get]      : playerSteamProfile
    +speed               [get/set]  : single
    +stance              [get/set]  : string
    +vanish              [get/set]  : boolean
    +virus               [get/set]  : byte
    +water               [get/set]  : byte
    +vehicle             [get]      : vehicle

playerClothing [Class]:
    +clear()
    +remove()
    +backpack            [get]      : item
    +glasses             [get]      : item
    +hat                 [get]      : item
    +mask                [get]      : item
    +pants               [get]      : item
    +shirt               [get]      : item
    +vest                [get]      : item

playerEffects [Class]:
    +hideCursor()
    +clearUIById(uInt16 id)
    +sendUI(uInt16 id, int16 key, [object arg0], [object arg1], [object arg2], [object arg3])
    +sendUIText(int16 key, string childName, string text)
    +showCursor()

playerEquipment [Class]:
    +dequip()
    +item                [get]      : item

playerInventory [Class]:
    +addItem(uInt16 itemId, [byte amount])
    +clear()
    +hasItem(int32 itemId) : boolean
    +removeItem(uInt16 itemId, [byte amount])
    +isStoring           [get]      : boolean
    +items               [get]      : object

playerLook [Class]:
    +getBarricade() : barricade
    +getPlayer() : player
    +getPoint() : vector3
    +getStructure() : structure
    +getVehicle() : vehicle

playerSteamProfile [Class]:
    +avatarUrl           [get]      : string
    +created             [get]      : dateTime
    +name                [get]      : string
    +url                 [get]      : string

random [Class]:
    Constructor: random()
    Constructor: random(int32 seed)
    +int() : int32
    +int(int32 maxValue) : int32
    +int(int32 minValue, int32 maxValue) : int32
    +double() : double

rocketGroup [Class]:
    +displayName         [get]      : string
    +id                  [get]      : string
    +prefix              [get]      : string
    +suffix              [get]      : string

server [Static Class]:
    +ban(string steamId, [string reason], [uInt32 duration], [boolean shouldBanIP]) : boolean
    +clearAllKeyValues()
    +execute(string command)
    +findBarricade(uInt32 instanceId) : barricade
    +findStructure(uInt32 instanceId) : structure
    +findVehicle(uInt32 instanceId) : vehicle
    +getBarricadesInRadius(vector3 position, single radius) : object
    +getGameGroup(string groupId) : gameGroup
    +getStructuresInRadius(vector3 position, single radius) : object
    +log(string message)
    +setBotPlayerCount(int32 numBots)
    +setGameData(string gameData)
    +setKeyValue(string key, string value)
    +unban(string steamId) : boolean
    +description         [get/set]  : string
    +ip                  [get]      : string
    +isDay               [get]      : boolean
    +isFullMoon          [get]      : boolean
    +isNight             [get]      : boolean
    +isRaining           [get]      : boolean
    +isSnowing           [get]      : boolean
    +map                 [get/set]  : string
    +name                [get/set]  : string
    +players             [get]      : object
    +port                [get]      : uInt16
    +time                [get]      : uInt32
    +vehicles            [get]      : object

sign [Class]:
    +barricade           [get]      : barricade
    +text                [get/set]  : string

spawner [Static Class]:
    +spawnAnimal(uInt16 id, vector3 position, [single angle])
    +spawnBarricade(uInt16 id, vector3 position, [single angleX], [single angleY], [single angleZ], [string owner], [string group]) : barricade
    +spawnItem(uInt16 id, vector3 position, [boolean wideSpread])
    +spawnStructure(uInt16 id, vector3 position, [single angleX], [single angleY], [single angleZ], [string owner], [string group]) : structure
    +spawnVehicle(uInt16 id, vector3 position, [single angle]) : vehicle

stopwatch[Class]:
    Constructor: stopwatch()
    +reset()
    +start()
    +stop()
    +elapsedMilliseconds [get]      : number
    +elapsedSeconds      [get]      : number
    +elapsedTicks        [get]      : number

storage [Class]:
    +open(player player)
    +barricade           [get]      : barricade
    +inventory           [get]      : inventory
    +isOpen              [get]      : boolean

String [Base Type]:
    +charAt(int32 index) : string
    +charCodeAt(int32 index) : int32
    +contains(string value) : boolean
    +endsWith(string value) : boolean
    +indexOf(string value) : int32
    +insert(int32 index, string value) : string
    +lastIndexOf(string value) : int32
    +removeRich() : string
    +replace(string oldValue, string newValue) : string
    +split(string separator) : object
    +startsWith(string value) : boolean
    +substring(int32 startIndex) : string
    +substring(int32 startIndex, int32 length) : string
    +toNumber() : object
    +toUpper() : string
    +toLower() : string
    +trim() : string
    +format(object... arguments) : string
    +length              [get]      : int32

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

time [Static Class]:
    +now                 [get]      : dateTime

Value [Base Type]:
    +toString() : string
    +type                [get]      : string

vector3 [Class]:
    Constructor: vector3(single x, single y, single z)
    +distance(vector3 other) : double
    +toString() : string
    +x                   [get/set]  : single
    +y                   [get/set]  : single
    +z                   [get/set]  : single

vehicle [Class]:
    +damage(uInt16 amount, boolean canRepair)
    +destroy()
    +explode()
    +popTires()
    +removePlayer(player player)
    +repair(uInt16 amount)
    +repairTires()
    +driver              [get]      : player
    +fuel                [get/set]  : uInt16
    +group               [get/set]  : string
    +health              [get/set]  : uInt16
    +id                  [get]      : uInt16
    +instanceId          [get]      : uInt32
    +inventory           [get]      : inventory
    +isDriven            [get]      : boolean
    +isLocked            [get/set]  : boolean
    +maxFuel             [get]      : uInt16
    +maxHealth           [get]      : uInt16
    +maxSpeed            [get]      : uInt16
    +minSpeed            [get]      : uInt16
    +name                [get]      : string
    +owner               [get/set]  : string
    +passengers          [get]      : object
    +position            [get]      : vector3
    +speed               [get]      : uInt16

wait [Static Class]:
    +seconds(single seconds, object function, object... arguments)

web [Static Class]:
    +get(string url) : string
    +getAsync(string url, object callbackFunction) : string


sarshane / uScript-EventsFixer

   Replaced broken .door with .getDoor()
   Fixed issues with callback things.