Advertisement
Guest User

CS2DLuaDoc

a guest
Dec 24th, 2024
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 40.68 KB | None | 0 0
  1. --- @alias PlayerID 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32
  2.  
  3. --- @alias ConsoleCommandsSettings "ah" | "autoscreen" | "autoswitch" | "bot_count" | "bot_jointeam" | "bot_prefix" | "bot_skill" | "bot_weapons" | "bullets" | "connection" | "debug" | "debugai" | "debuglog" | "debuglua" | "dmgindicator" | "drawradar" | "fowalpha" | "fowdetails" | "gore" | "grenademode" | "hud_fastswitch" | "itemshadows" | "localport" | "mapshadows" | "mapsounds" | "markplayer" | "menu_lanscanport" | "mp_antispeeder" | "mp_autogamemode" | "mp_autoteambalance" | "mp_buytime" | "mp_c4timer" | "mp_connectionlimit" | "mp_curtailedexplosions" | "mp_damagefactor" | "mp_deathdrop" | "mp_dispenser_health" | "mp_dispenser_money" | "mp_dmspawnmoney" | "mp_dropgrenades" | "mp_flashlight" | "mp_floodprot" | "mp_floodprotignoretime" | "mp_freezetime" | "mp_grenaderebuy" | "mp_hostagepenalty" | "mp_hovertext" | "mp_hud" | "mp_hudscale" | "mp_idleaction" | "mp_idlekick" | "mp_idletime" | "mp_infammo" | "mp_kevlar" | "mp_kickpercent" | "mp_killbuildingmoney" | "mp_killbuildings" | "mp_killinfo" | "mp_killteambuildings" | "mp_lagcompensation" | "mp_lagcompensationdivisor" | "mp_localrconoutput" | "mp_luamap" | "mp_luaserver" | "mp_mapgoalscore" | "mp_mapvoteratio" | "mp_maxclientsip" | "mp_maxrconfails" | "mp_natholepunching" | "mp_pinglimit" | "mp_postspawn" | "mp_radar" | "mp_randomspawn" | "mp_recoil" | "mp_respawndelay" | "mp_roundlimit" | "mp_roundtime" | "mp_shotweakening" | "mp_smokeblock" | "mp_startmoney" | "mp_supply_items" | "mp_teamkillpenalty" | "mp_teleportreload" | "mp_tempbantime" | "mp_timelimit" | "mp_tkpunish" | "mp_trace" | "mp_turretdamage" | "mp_unbuyable" | "mp_vulnerablehostages" | "mp_weaponfadeout" | "mp_winlimit" | "mp_zombiedmg" | "mp_zombiekillequip" | "mp_zombiekillscore" | "mp_zombierecover" | "mp_zombiespeedmod" | "name" | "particles" | "playershadows" | "recoil" | "relativemovement" | "renderdecals" | "renderdecoration" | "shadows" | "shadowshade_obstacle" | "shadowshade_wall" | "soundmode" | "spraycolor" | "spraylogo" | "sv_checkusgnlogin" | "sv_daylighttime" | "sv_fow" | "sv_friendlyfire" | "sv_gamemode" | "sv_hostport" | "sv_lan" | "sv_map" | "sv_maptransfer" | "sv_maxplayers" | "sv_name" | "sv_offscreendamage" | "sv_password" | "sv_specmode" | "sv_spraytransfer" | "sv_usgnonly" | "tileanimations" | "transfer_speed" | "visibleshots" | "volume" | "wiggle"
  4.  
  5. --- @alias BindKeyNumeric "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  6. --- @alias BindKeyAlphabetic "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
  7. --- @alias BindKeyFunction "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12"
  8. --- @alias BindKeyMouse "mouse1" | "mouse2" | "mouse3" | "mwheelup" | "mwheeldown"
  9. --- @alias BindKeySpecial "leftshift" | "rightshift" | "leftctrl" | "rightctrl" | "leftalt" | "rightalt" | "leftsys" | "rightsys"
  10. --- @alias BindKeyArrow "leftarrow" | "rightarrow" | "uparrow" | "downarrow"
  11. --- @alias BindKeyOther "backspace" | "tab" | "clear" | "enter" | "escape" | "space" | "pgup" | "pgdn" | "end" | "home" | "select" | "print" | "execute" | "screen" | "ins" | "del" | "kp_leftarrow" | "kp_home" | "kp_ins" | "kp_0" | "kp_1" | "kp_2" | "kp_3" | "kp_4" | "kp_5" | "kp_6" | "kp_7" | "kp_8" | "kp_9" | "kp_divide" | "kp_multiply" | "kp_del"
  12. --- @alias BindKeyValue BindKeyNumeric | BindKeyAlphabetic | BindKeyFunction | BindKeyMouse | BindKeySpecial | BindKeyArrow | BindKeyOther
  13.  
  14. --- @alias HookValueBasic "break" | "endround" | "httpdata" | "log" | "mapchange" | "parse" | "projectile" | "projectile_impact" | "rcon" | "shutdown" | "startround" | "startround_prespawn" | "trigger" | "triggerentity"
  15. --- @alias HookValueTime "always" | "minute" | "ms100" | "second"
  16. --- @alias HookValuePlayer "assist" | "attack" | "attack2" | "bombdefuse" | "bombexplode" | "bombplant" | "build" | "buildattempt" | "buy" | "clientdata" | "clientsetting" | "collect" | "connect" | "die" | "disconnect" | "dominate" | "drop" | "flagcapture" | "flagtake" | "flashlight" | "hit" | "hostagedamage" | "hostagekill" | "hostagerescue" | "hostageuse" | "itemfadeout" | "join" | "key" | "kill" | "leave" | "menu" | "move" | "movetile" | "name" | "radio" | "reload" | "say" | "sayteam" | "select" | "serveraction" | "shieldhit" | "spawn" | "specswitch" | "spray" | "suicide" | "team" | "use" | "usebutton" | "vipescape" | "vote" | "walkover"
  17. --- @alias HookValueObject "hitzone" | "objectdamage" | "objectkill" | "objectupgrade" | "turretscan"
  18. --- @alias HookValue HookValueBasic | HookValueTime | HookValuePlayer | HookValueObject
  19.  
  20. --- @alias EntityValue "exists" | "typename" | "type" | "name" | "trigger" | "state" | "int0" | "int1" | "int2" | "int3" | "int4" | "int5" | "int6" | "int7" | "int8" | "int9" | "str0" | "str1" | "str2" | "str3" | "str4" | "str5" | "str6" | "str7" | "str8" | "str9" | "aistate"
  21. --- @alias GameValue "version" | "dedicated" | "phase" | "round" | "timeleft" | "maptimeleft" | "score_t" | "score_ct" | "winrow_t" | "winrow_ct" | "nextmap" | "ticks" | "port" | "bombplanted" | "sysfolder" | ConsoleCommandsSettings
  22.  
  23. --- @alias HostageValueBoolean "exists" | "used"
  24. --- @alias HostageValueNumbers "health" | "follow" | "look" | "x" | "y" | "rot" | "tilex" | "tiley"
  25. --- @alias HostageValueTable "table"
  26. --- @alias HostageValue HostageValueBoolean | HostageValueNumbers | HostageValueTable
  27.  
  28. --- @alias ImageparamValueStrings "path"
  29. --- @alias ImageparamValueNumbers "x" | "y" | "rot" | "alpha" | "frame" | "width" | "height" | "framecount"
  30. --- @alias ImageparamValue ImageparamValueStrings | ImageparamValueNumbers
  31.  
  32. --- @alias ObjectValueBoolean "exists" | "entity"
  33. --- @alias ObjectValueNumbers "type" | "health" | "mode" | "team" | "player" | "x" | "y" | "rot" | "alpha" | "tilex" | "tiley" | "countdown" | "rootrot" | "idle" | "rotvar" | "target" | "upgrade" | "entityx" | "entityy"
  34. --- @alias ObjectValueTable "table"
  35. --- @alias ObjectValues ObjectValueBoolean | ObjectValueNumbers | ObjectValueTable
  36.  
  37. --- @alias WeaponItemValueBoolean "exists" | "dropped"
  38. --- @alias WeaponItemValueNumbers "type" | "player" | "ammo" | "ammoin" | "mode" | "x" | "y" | "droptimer"
  39. --- @alias WeaponItemValueStrings "name"
  40. --- @alias WeaponItemValueTable "table"
  41. --- @alias WeaponItemValues WeaponItemValueBoolean | WeaponItemValueNumbers | WeaponItemValueStrings | WeaponItemValueTable
  42.  
  43. --- @alias ObjectTypeValueStrings "name" | "internalname"
  44. --- @alias ObjectTypeValueNumbers "type" | "price" | "health" | "killmoney" | "limit" | "upgradepoints" | "upgradeprice" | "upgradeto"
  45.  
  46. --- @alias WeaponItemTypeValueStrings "name"
  47. --- @alias WeaponItemTypeValueNumbers "dmg" | "dmg_z1" | "dmg_z2" | "rate" | "reload" | "ammo" | "ammoin" | "price" | "range" | "dispersion" | "slot" | "recoil"
  48. --- @alias WeaponItemTypeValue WeaponItemTypeValueStrings | WeaponItemTypeValueNumbers
  49.  
  50. --- @alias MapValueStrings "name" | "tileset" | "back_img"
  51. --- @alias MapValueNumbers "xsize" | "ysize" | "tilesize" | "tilecount" | "back_scrollx" | "back_scrolly" | "back_scrolltile" | "back_r" | "back_g" | "back_b" | "storm_x" | "storm_y" | "mission_vips" | "mission_hostages" | "mission_bombspots" | "mission_ctfflags" | "mission_dompoints" | "nobuying" | "noweapons" | "teleporters" | "botnodes"
  52. --- @alias MapValue MapValueStrings | MapValueNumbers
  53.  
  54. --- @alias PlayerValueBoolean "exists" | "bot" | "rcon" | "defusekit" | "gasmask" | "bomb" | "flag" | "reloading" | "nightvision"
  55. --- @alias PlayerValueStrings "name" | "ip" | "usgnname" | "steamid" | "steamname" | "language" | "language_iso" | "sprayname"
  56. --- @alias PlayerValueNumbers "port" | "usgn" | "team" | "favteam" | "look" | "spraycolor" | "mousex" | "mousey" | "mousemapx" | "mousemapy" | "mousedist" | "screenw" | "screenh" | "widescreen" | "windowed" | "micsupport" | "x" | "y" | "tilex" | "tiley" | "rot" | "health" | "maxhealth" | "armor" | "money" | "score" | "deaths" | "teamkills" | "hostagekills" | "teambuildingkills" | "mvp" | "assists" | "ping" | "idle" | "speedmod" | "spectating" | "ai_flash" | "weapontype" | "weaponmode" | "process" | "votekick" | "votemap"
  57. --- @alias PlayerValueTable "table" | "tableliving" | "team1" | "team2" | "team1living" | "team2living"
  58. --- @alias PlayerValue PlayerValueBoolean | PlayerValueStrings | PlayerValueNumbers | PlayerValueTable
  59.  
  60. --- @alias StatsValueBoolean "exists" | "rank" | "killsperdeath" | "score" | "frags" | "deaths" | "secs" | "mvp" | "assists"
  61. --- @alias StatsValueNumbers "rank" | "killsperdeath" | "score" | "frags" | "deaths" |
  62. --- @alias StatsValue StatsValueBoolean | StatsValueNumbers
  63.  
  64. --- @alias ProjectileValue "exists" | "type" | "x" | "y" | "dir" | "rot" | "flydist" | "time"
  65.  
  66. --- @alias TileValueBoolean "walkable" | "deadly" | "wall" | "obstacle" | "hascustomframe"
  67. --- @alias TileValueNumbers "frame" | "property" | "entity" | "originalframe" | "rot" | "blend" | "brightness"
  68. --- @alias TileValueTable "color"
  69. --- @alias TileValue TileValueBoolean | TileValueNumbers | TileValueTable
  70.  
  71. --- @alias ObjectType 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | 30 | 40
  72. --- @alias TilePropertyType 0 | 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 50 | 51 | 52 | 53
  73.  
  74. --- @alias ImageModeCoveredByPlayer 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132
  75. --- @alias ImageModeCoveringPlayer 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232
  76. --- @alias ImageModeCoveringPlayerAndEntity 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164
  77. --- @alias ImageMode 0 | 1 | 2 | 3 | 4 | ImageModeCoveredByPlayer | ImageModeCoveringPlayer | ImageModeCoveringPlayerAndEntity
  78. --- @alias ImageHitzoneMode 0 | 1 | 2 | 3 | 4 | 101 | 102 | 103 | 104
  79. --- @alias ImageBlendMode 0 | 1 | 2 | 3
  80. --- @alias ImageAnimationMode 0 | 1 | 2 | 3 | 4
  81.  
  82. --- @alias WeaponItemTypePistol 1 | 2 | 3 | 4 | 5 | 6
  83. --- @alias WeaponItemTypeShotgun 10 | 11
  84. --- @alias WeaponItemTypeSMG 20 | 21 | 22 | 23 | 24
  85. --- @alias WeaponItemTypeBigGuns 40 | 45 | 46 | 47 | 48 | 49 | 88 | 90
  86. --- @alias WeaponItemTypeRifle 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 91
  87. --- @alias WeaponItemTypeMelee 50 | 69 | 74 | 78 | 85
  88. --- @alias WeaponItemTypeGrenades 51 | 52 | 53 | 54 | 72 | 73 | 75 | 76 | 86 | 89
  89. --- @alias WeaponItemTypeMines 77 | 87
  90. --- @alias WeaponItemTypeEquipment 41 | 56 | 57 | 58 | 59 | 60 | 61 | 62
  91. --- @alias WeaponItemTypeStuff 55 | 63 | 64 | 65 | 66 | 67 | 68 | 70 | 71
  92. --- @alias WeaponItemTypeArmor 79 | 80 | 81 | 82 | 83 | 84
  93. --- @alias WeaponItemType WeaponItemTypePistol | WeaponItemTypeShotgun | WeaponItemTypeSMG | WeaponItemTypeRifle | WeaponItemTypeBigGuns | WeaponItemTypeMelee | WeaponItemTypeGrenades | WeaponItemTypeMines | WeaponItemTypeEquipment | WeaponItemTypeStuff | WeaponItemTypeArmor
  94.  
  95. --- @alias ReqcldMode 0 | 1 | 2 | 3 | 4 | 5 | 6
  96.  
  97. --- Adds a Lua key bind for the specified key. This bind will be active for all players and will trigger the key-hook when a player presses or releases the related key.'
  98. ---
  99. --- Returns 1 if adding the key bind worked, 0 otherwise (invalid key name / already bound).
  100. --- @param key PlayerID
  101. --- @return 0 | 1
  102. function addbind(key)end
  103.  
  104. --- Attaches the Lua function "func" to the hook "hook". CS2D will always call that Lua function when the event related to that hook occurs.
  105. ---
  106. --- You can add an unlimited amount of different functions to each hook - but bear in mind that this might affect the performance in a negative way. Especially for hooks which are called frequently.
  107. --- @param hook HookValue
  108. --- @param func string
  109. --- @param priority? number
  110. function addhook(hook, func, priority)end
  111.  
  112. --- Bot with given ID aims at the given position (x|y) on the map (in pixels).
  113. --- @param id PlayerID
  114. --- @param x number
  115. --- @param y number
  116. function ai_aim(id, x, y)end
  117.  
  118. --- Bot with given ID performs an attack. Set secondary to 1 to use the secondary weapon function (=attack2) instead of the primary function.
  119. --- @param id PlayerID
  120. --- @param secondary? 0 | 1
  121. function ai_attack(id, secondary)end
  122.  
  123. --- Bot with given ID tries to purchase a certain item
  124. --- @param id PlayerID
  125. --- @param itemtype WeaponItemType
  126. function ai_buy(id, itemtype)end
  127.  
  128. --- Set debug-text for bot (only displayed if "debugai" is enabled).
  129. --- @param id PlayerID
  130. --- @param text string
  131. function ai_debug(id, text)end
  132.  
  133. --- Bot with given ID drops the current weapon.
  134. --- @param id PlayerID
  135. function ai_drop(id)end
  136.  
  137. --- Returns the ID of the closest enemy to the player with the specified ID or 0 when no enemy was found.
  138. ---
  139. --- Only players which are close enough (inside the virtual screen of the player) will be returned.
  140. ---
  141. --- When fog of war is enabled players behind walls won't be returned.
  142. --- @param id PlayerID
  143. --- @return number
  144. function ai_findtarget(id)end
  145.  
  146. --- Checks if there is a free line between the bot with the given ID and the given position (x|y) (in pixels).
  147. --- @param id PlayerID
  148. --- @param x number
  149. --- @param y number
  150. --- @return boolean
  151. function ai_freeline(id, x, y)end
  152.  
  153. --- Bot with the given ID goes to tile (x|y). Set walk to 1 to let it walk (silent).
  154. ---
  155. --- @Returns {0, 1 or 2}
  156. --- >0 - when failed to find path,
  157. ---
  158. --- >1 - when target is reached or
  159. ---
  160. --- >2 - when bot is still on its way.
  161. --- @param id PlayerID
  162. --- @param x number
  163. --- @param y number
  164. --- @param walk? number
  165. --- @return 0 | 1 | 2
  166. function ai_goto(id, x, y, walk)end
  167.  
  168. --- Bot with given ID performs an intelligent attack.
  169. ---
  170. --- This includes some additional logic:
  171. ---
  172. --- >If the current weapon has limited ammo, is empty and has spare ammo, a reload will be triggered and attacking will continue after reloading
  173. ---
  174. --- >If the current weapon is entirely empty (no spare ammo), switch to the next best weapon which can be used for attacking (in most cases pistol or melee)
  175. --- @param id PlayerID
  176. function ai_iattack(id)end
  177.  
  178. --- Bot with given ID moves into a certain direction (defined with the given angle from 0° to 360°).
  179. ---
  180. --- Set walk to 1 to let it walk.
  181. ---
  182. --- Returns 1 when successful or 0 when way is blocked.
  183. --- @param id PlayerID
  184. --- @param angle number
  185. --- @param walk? 0 | 1
  186. --- @return 0 | 1
  187. function ai_move(id, angle, walk)end
  188.  
  189.  
  190. --- Bot with given ID sends a radio message.
  191. --- @param id PlayerID
  192. --- @param radioid number
  193. function ai_radio(id, radioid)end
  194.  
  195. --- Bot with given ID reloads the current weapon.
  196. --- @param id PlayerID
  197. function ai_reload(id)end
  198.  
  199. --- Bot with given ID respawns (only if dead and only if game mode allows it).
  200. --- @param id PlayerID
  201. function ai_respawn(id)end
  202.  
  203. --- Bot with given ID instantly turns to certain direction/angle (from 0° to 360°).
  204. --- @param id PlayerID
  205. --- @param angle number
  206. function ai_rotate(id, angle)end
  207.  
  208. --- Bot with given ID says the given text using the chat system.
  209. --- @param id PlayerID
  210. --- @param text string
  211. function ai_say(id, text)end
  212.  
  213. --- Bot with given ID says the given text to the own team only (using team chat).
  214. --- @param id PlayerID
  215. --- @param text string
  216. function ai_sayteam(id, text)end
  217.  
  218. --- Bot with given ID selects the weapon specified with itemtype.
  219. --- @param id PlayerID
  220. --- @param itemtype WeaponItemType
  221. function ai_selectweapon(id, itemtype)end
  222.  
  223. --- Bot with given ID sprays a spraylogo at its current position.
  224. --- @param id PlayerID
  225. function ai_spray(id)end
  226.  
  227. --- Bot with given ID uses the environement (like pressing use-key).
  228. --- @param id PlayerID
  229. function ai_use(id)end
  230.  
  231. --- Returns the SHA256 checksum of the file at this path.
  232. --- @param path string
  233. --- @return string
  234. function checksumfile(path)end
  235.  
  236. --- Returns the SHA256 checksum of the given string.
  237. --- @param string string
  238. --- @return string
  239. function checksumstring(string)end
  240.  
  241. --- Returns the tile x and y position (2 values!) of the closest living and unused hostage to a given player. Returns -100,-100 if no hostage has been found.
  242. ---
  243. --- Note: The returned position is in tiles, NOT in pixels!
  244. --- @param playerid PlayerID
  245. --- @return number, number
  246. function closehostage(playerid)end
  247.    
  248. --- Returns a Lua table with all IDs of items which are close to the player specified with the id parameter.
  249. ---
  250. --- Only dropped items which are within the range will be returned.
  251. ---
  252. --- The unit for the range is tiles (range 1 equals 32 pixels for example).
  253. --- @param id PlayerID
  254. --- @param range number
  255. --- @return number[]
  256. function closeitems(id, range)end
  257.  
  258. --- Returns a list of objects which are within the specified radius (in pixels) around the specified position (X|Y) in pixels.
  259. ---
  260. --- Use type to limit the search to objects with a certain type only.
  261. --- @param x number
  262. --- @param y number
  263. --- @param radius number
  264. --- @param type? ObjectType
  265. function closeobjects(x, y, radius, type)end
  266.  
  267. --- Returns a list of all alive players (IDs) which are within the specified radius (in pixels) around the specified position (x|y) in pixels
  268. --- @param x number
  269. --- @param y number
  270. --- @param radius number
  271. --- @param team? 0 | 1 | 2
  272. --- @return PlayerID[]
  273. function closeplayers(x, y, radius, team)end
  274.  
  275. --- Returns a value of an entity at the tile position (X|Y).
  276. ---
  277. --- Note: There is no entity(0,"table") as it is common for comparable commands! Use the command "entitylist" instead!
  278. --- @param x number
  279. --- @param y number
  280. --- @param value EntityValue
  281. --- @return string | boolean | number
  282. function entity(x, y, value)end
  283.  
  284. --- Returns a list (Lua table) containing the positions (as X and Y tile coordinates) of all entities (except for Env_Decal).
  285. ---
  286. --- You can also limit the output to a certain entity type by using the optional type parameter.
  287. ---
  288. --- Note: The resulting "list" is actually a Lua table with one sub Lua table per entity in it. The sub tables have the fields/indices "x" and "y" which contain the X and Y tile coordinates of an entity.
  289. ---
  290. --- Attention: Env_Decal entities are NOT included in this list!
  291. --- @param type? ObjectType
  292. --- @return {x: number, y: number}[]
  293. function entitylist(type)end
  294.    
  295. --- Removes a function from a hook.
  296. ---
  297. --- Nothing will happen if the function has not been attached to the hook with addhook before.
  298. --- @param hook HookValue
  299. --- @param func string
  300. function freehook(hook, func)end
  301.    
  302. --- Removes an image completely.
  303. ---
  304. --- Attention: The variable(s) you used to save the image ID will NOT be changed by CS2D! Please set them to nil manually!
  305. ---
  306. --- Attention: CS2D recycles image IDs! As soon as an image with ID X gets removed, a new image which is created afterwards might receive that very same ID again!
  307. --- That's why it is very important to set the variable with the ID to nil to make sure that your script never tries to access this image again.
  308. --- Otherwise your script might modify a completely different image!
  309. --- @param id number
  310. function freeimage(id)end
  311.    
  312. --- Removes timers which call the specified "func" with the specified "param".
  313. ---
  314. --- If "param" is not set (or ""), all timers with the matching "func" will be removed.
  315. ---
  316. --- If neither "func" nor "param" is set (or if both are ""), this will remove ALL existing timers.
  317. ---
  318. --- Once a timer has been removed it won't be executed anymore.
  319. ---
  320. --- Of course you can create the same time again if you want to.
  321. ---
  322. --- Note: You do not have to remove timers with a limited call count manually. They will remove themselves when they expire.
  323. ---
  324. --- Attention: Be very careful with the parameters. If both are empty / empty strings (""), you will remove ALL timers!
  325. --- @param func? string
  326. --- @param param? string
  327. function freetimer(func, param)end
  328.  
  329. --- Shows Lua functions in the Lua main table in the console of CS2D. For debugging purposes only.
  330. function funcs()end
  331.  
  332. --- Returns a game state/setting.
  333. --- @param value GameValue
  334. --- @return string | number | boolean
  335. function game(value)end
  336.  
  337. --- Checks if any alive player is within the specified radius (in pixels) around the specified position (x|y) in pixels.
  338. ---
  339. --- Returns a boolean true, if at least one player matching the criteria was found. Otherwise false.
  340. --- @param x number
  341. --- @param y number
  342. --- @param radius number
  343. --- @param team? 0 | 1 | 2
  344. --- @return boolean
  345. function hascloseplayers(x, y, radius,team)end
  346.  
  347. --- Returns a value of a hostage:
  348. ---
  349. --- hostage(0, "table"): a Lua table with all hostage IDs
  350. --- @param id number
  351. --- @param value HostageValue
  352. --- @return boolean | number | number[]
  353. function hostage(id, value)end
  354.  
  355. --- Creates an image (dynamic object) on the map and returns the ID for that image.
  356. ---
  357. --- The path is relative to the CS2D folder. The position is defined via x and y in pixels. mode defines how the image is displayed (see list below).
  358. ---
  359. --- Use the optional player parameter if you want the image to be visible to a certain player only (it's visible to all players by default).
  360. --- @param path string
  361. --- @param x number
  362. --- @param y number
  363. --- @param mode ImageMode
  364. --- @param player? number
  365. --- @return number
  366. function image( path, x, y, mode, player)end
  367.  
  368. --- Changes the opacity (also known as alpha, 0.0 transparent - 1.0 opaque) of an image.
  369. ---
  370. --- This can either be used to make an image (semi-)transparent / fully opaque or to temporarily hide an image completely (alpha 0).
  371. --- @param id number
  372. --- @param alpha number
  373. function imagealpha(id, alpha)end
  374. --- Changes the blendmode of an image:
  375. ---
  376. --- >0 for normal (pixels are alpha blended, default mode)
  377. ---
  378. --- >1 for light (pixels are added)
  379. ---
  380. --- >2 for shade (pixels are multiplied)
  381. ---
  382. --- >3 for solid (pixels are overwritten, alpha transparency is ignored)
  383. --- @param id number
  384. --- @param mode ImageBlendMode
  385. function imageblend(id, mode)end
  386.  
  387. --- Undocumented, enables/disables shadow for an image
  388. --- @param id number
  389. --- @param shadow 0 | 1
  390. function imageshadow(id, shadow)end
  391.  
  392. --- Changes the color of an image (use a colorpicker to get the values).
  393. ---
  394. --- The color is specified as red, green and blue values. Each ranging from 0 (black) to 255 (full color brightness)
  395. --- @param id number
  396. --- @param red number
  397. --- @param green number
  398. --- @param blue number
  399. function imagecolor( id, red, green, blue)end
  400.  
  401. --- Changes the frame of the spritesheet image with the specified id. Has no effect if the image is not a spritesheet.
  402. ---
  403. --- The frame starts with 1 for the first frame. If you attempt to set the frame lower than 1 or larger than the maximum number of frames, the frame will be set to the first or last frame respectively.
  404. ---
  405. --- The frames are numbered from left to right and from top to bottom. So the top left frame is frame number 1 and the bottom right frame is the last frame.
  406. --- @param id number
  407. --- @param frame number
  408. function imageframe(id, frame)end
  409.  
  410. --- Adds, removes or modifies a hit zone for an image which reacts to shots/attacks
  411. ---
  412. --- Each hit zone will trigger the hitzone-hook when it is hit by a shot/attack.
  413. ---
  414. --- Non-Blocking Modes (<=100, shots will pass through)
  415. ---
  416. --- 0 - no hit zone (this removes existing hit zones, other parameters don't matter)
  417. ---
  418. --- 1 - hit zone without effects (just register)
  419. ---
  420. --- 2 - wall effect
  421. ---
  422. --- 3 - blood effect
  423. ---
  424. --- 4 - green blood effect
  425. ---
  426. --- Blocking Modes (>100, shots will get stopped)
  427. ---
  428. --- 101 - hit zone without effects + stop shot
  429. ---
  430. --- 102 - wall effect + stop shot
  431. ---
  432. --- 103 - blood effect + stop shot
  433. ---
  434. --- 104 - green blood effect + stop shot
  435. ---
  436. --- All hit zones with modes which are higher than 100 will block the shots (objects behind them will not be damaged).
  437. ---
  438. --- They basically behave like walls but they have no influence on player movement or vision.
  439. --- @param id number
  440. --- @param mode ImageHitzoneMode
  441. function imagehitzone(id, mode)end
  442.  
  443. --- Returns a value of an image.
  444. --- @param id number
  445. --- @param value ImageparamValue
  446. --- @return string | number
  447. function imageparam(id, value)end
  448.  
  449. --- Changes the position (x & y, pixels) and rotation (rot, 0°-360°) of an image.
  450. --- @param id number
  451. --- @param x number
  452. --- @param y number
  453. --- @param rot number
  454. function imagepos(id, x, y, rot)end
  455.  
  456. --- Changes the image scale factors (in other words: the image size).
  457. --- @param id number
  458. --- @param x number
  459. --- @param y number
  460. function imagescale(id, x, y)end
  461.  
  462. --- Checks if the tile position (x|y) is inside the area of a certain entity type and returns true if this is the case and false otherwise.
  463. ---
  464. --- The "area" of an entity depends on the entity type and and in some cases on its properties.
  465. --- @param x number
  466. --- @param y number
  467. --- @param type ObjectType
  468. --- @return boolean
  469. function inentityzone(x, y, type)end
  470.  
  471. --- Returns a value of an item instance on the map.
  472. ---
  473. --- item(0,"table"): returns a Lua table with all IDs of items which are on the map (the unique instance IDs, NOT the type IDs!)
  474. --- @param id number
  475. --- @param value WeaponItemValues
  476. --- @return boolean | number | string | number[]
  477. function item(id, value)end
  478.  
  479. --- Returns a value of an item type.
  480. ---
  481. --- The values are the same for all objects of that type.
  482. --- @param type WeaponItemType
  483. --- @param value WeaponItemTypeValue
  484. --- @return string | number
  485. function itemtype(type, value)end
  486.  
  487. -- Returns info about the current map.
  488. --- @param value MapValue
  489. --- @return string | number
  490. function map(value)end
  491.  
  492. --- Opens a menu on the screen of a certain player (id=player id) or at the screen of every player (id=0)!
  493. ---
  494. --- The 'content' string defines the look and content of the menu.
  495. ---
  496. --- Scheme: "title,b1,b2,...,b9"
  497. ---
  498. --- title = title of the menu (Attach @b at the end of title for a bigger menu or @i for an invisible menu)
  499. ---
  500. --- b1-b9 = up to 9 button captions. Use empty strings for buttons you don't need.
  501. ---
  502. --- Captions can also be split into 2 parts by using "|" (scheme: "left caption|right caption").
  503. ---
  504. --- Moreover you can put () around a caption to make a disabled button.
  505. ---
  506. --- The menu-hook is executed when a player hits a menu button with the mouse or presses the corresponding numeric key.
  507. --- @param id number
  508. --- @param content string
  509. function menu(id, content)end
  510.  
  511. --- Sends "text" as server message to all players. It will be displayed in the chat area of the screen (bottom left).
  512. ---
  513. --- You can start "text" with an RGB color code "©RRRGGGBBB" to change its color. (use a colorpicker to get the values)
  514. ---
  515. --- It's also possible to display the text at the center of the screen. Just end "text" with "@C" (read: at center) to do so!
  516. --- @param text string | number
  517. function msg(text)end
  518.  
  519. --- Sends "text" to a certain player (id) only. It will be displayed in the chat area of the screen of that player (bottom left).
  520. ---
  521. --- You can start "text" with an RGB color code "©RRRGGGBBB...." to change its color. (use a colorpicker to get the values)
  522. ---
  523. --- It's also possible to display the text at the center of the screen. Just end "text" with "@C" (read: at center) to do so!
  524. --- @param player PlayerID
  525. --- @param text string | number
  526. function msg2(player, text)end
  527.  
  528. --- Returns a value of a dynamic object
  529. ---
  530. --- object(0,"table"): a Lua table with all dynamic object IDs
  531. --- @param id number
  532. --- @param value ObjectValues
  533. --- @return boolean | number | number[]
  534. function object(id, value)end
  535.  
  536. --- Returns the ID of the first object which is found at the tile position (X|Y) and which has the specified type.
  537. ---
  538. --- The function will return the first object of any type at this position if no type is specified.
  539. ---
  540. --- The function returns 0 if nothing is found at the specified position / with the specified type.
  541. --- @param x number
  542. --- @param y number
  543. --- @param type? ObjectType
  544. --- @return number
  545. function objectat(x, y, type)end
  546.  
  547. --- Returns a value of an object type (NOT an object instance on the map).
  548. ---
  549. --- The values are the same for all objects of that type.
  550. --- @param type ObjectType
  551. --- @param value ObjectTypeValue
  552. --- @return string | number
  553. function objecttype(type, value)end
  554.  
  555. --- Executes ordinary non-Lua CS2D commands.
  556. ---
  557. --- Everything behind the first semicolon (;) will be ignored.
  558. ---
  559. --- This is a security measurement in case you're using user input (like chat messages) with this command.
  560. ---
  561. --- You can change this behavior by setting Stop-At-Semicolon to 0.
  562. --- @param commands string
  563. --- @param stopAtSemicolon? number
  564. function parse(commands, stopAtSemicolon)end
  565.  
  566. --- Returns a value of a player or a table of players. Returns false if the specified player, value or table does not exist.
  567. --- @param player PlayerID
  568. --- @param value PlayerValue
  569. --- @return boolean | string | number | PlayerID[]
  570. function player(player, value)end
  571.  
  572. --- Returns how much ammo the specified player has left in the specified weapon.
  573. ---
  574. --- Returns two values:
  575. ---
  576. --- >The ammo currently loaded into the weapon and
  577. ---
  578. --- >the spare ammo for reloading
  579. --- @param id PlayerID
  580. --- @param itemtype WeaponItemType
  581. --- @return number, number
  582. function playerammo(id, itemtype)end
  583.  
  584. --- Returns a Lua table with all equippable weapon/item TYPES a player carries.
  585. --- @param id PlayerID
  586. --- @return WeaponItemType[]
  587. function playerweapons(id)end
  588.  
  589. --- Shows text in console.
  590. ---
  591. --- You can start "text" with an RGB color code "©RRRGGGBBB" to change its color. (use a colorpicker to get the values)
  592. ---
  593. --- You can input multiple arguments to print multiple times in the same line with a space between each argument.
  594. ---@param ... any
  595. function print(...)end
  596.  
  597. --- Returns a value of a projectile (projectiles are grenades and most stuff launched by weapons which is visible for multiple frames.
  598. --- Regular bullets are NO projectiles though)
  599. --- @param id number
  600. --- @param player PlayerID
  601. --- @param value ProjectileValue
  602. --- @return string | number | boolean
  603. function projectile(id, player, value)end
  604.  
  605. --- Returns a list (Lua table) containing projectile key data (IDs and parent player) of all flying or ground projectiles.
  606. ---
  607. --- You can also limit the output to the projectiles of a certain player (player=0 is default and will list projectiles of all players).
  608. ---
  609. --- The list parameter can either be 0 (default) for all flying projectiles or 1 for all ground projectiles.
  610. --- @param list? number
  611. --- @param player? PlayerID
  612. --- @return {id: number, player: number}[]
  613. function projectilelist(list, player)end
  614.  
  615. --- Returns the tile x and y position (2 values!) of a random entity of a certain type or -100,-100 if no entity has been found.
  616. ---
  617. --- Use AI-State to only find entities with this AI state (-1 or omit to ignore the AI-state).
  618. ---
  619. --- Use int0 to only find entities with this int0 value (-1 or omit to ignore the int0 value).
  620. --- @param type number
  621. --- @param aiState? number
  622. --- @param int0? number
  623. --- @return number, number
  624. function randomentity(type, aiState, int0)end
  625.  
  626. --- Returns the tile x and y position (2 values!) of a random living and unused (not following anyone) hostage. Returns -100,-100 if no hostage has been found.
  627. ---
  628. --- Set unused to 0 if you want to get used hostages as well!
  629. --- @param unused? number
  630. function randomhostage(unused)end
  631.  
  632. --- Removes all Lua key binds. This will entirely disable all additional network traffic caused by key binds and the key-hook won't be called anymore.
  633. function removeallbinds()end
  634.  
  635. --- Removes a specific Lua key bind. They key must have been added beforehand with addbind.
  636. ---
  637. --- Returns 1 if the bind was removed, 0 if the bind did not exist.
  638. --- @param key BindKeyValue
  639. --- @return 0 | 1
  640. function removebind(key)end
  641.  
  642. --- reqcld is short for "request client data". This command requests data from a single player client (id=player id) or from all clients (id=0).
  643. ---
  644. --- Mode specifies which data the server will receive:
  645. ---
  646. --- >Mode 0: Cursor position (cursor position on screen in pixels, scaled based on mp_hudscale)
  647. ---
  648. --- Deprecated: It is recommended to use player with parameters "mousex"/"mousey" instead!
  649. ---
  650. --- >Mode 1: Map scrolling (scrolling offset in pixels)
  651. ---
  652. --- >Mode 2: Absolute cursor position (cursor position on map in pixels, NOT influenced by mp_hudscale)
  653. ---
  654. --- Deprecated: It is recommended to use player with parameters "mousemapx"/"mousemapy" instead!
  655. ---
  656. --- >Mode 3: 1 if the client has the advanced light engine enabled, 0 otherwise (second value always 0)
  657. ---
  658. --- >Mode 4: 1 if the file specified with parameter (file path relative to the CS2D folder) has been loaded, 0 otherwise; checksum of the file (only if the file is under gfx/ or sfx/) as provided by checksumfile
  659. ---
  660. --- >Mode 5: Mod info
  661. ---
  662. --- >Mode 6: 1 if the client has 3D rendering (render3d) enabled, 0 otherwise (second value always 0)
  663. ---
  664. --- The last parameter is not required for all modes. For some modes (mode 4) it is crucial though.
  665. ---
  666. --- Please read the descriptions of the modes to learn when and how it is used.
  667. ---
  668. --- The requested data will be received with a delay. This is because it is sent over the network. You have to use the clientdata-hook to handle the incoming data!
  669. --- @param id number
  670. --- @param mode ReqcldMode
  671. --- @param parameter? string
  672. function reqcld(id, mode, parameter)end
  673.  
  674. --- reqhttp is short for "request HTTP". HTTP is used to request data from web pages / web services.
  675. ---
  676. --- "url" = The domain name or IP e.g. "cs2d.com"
  677. ---
  678. --- "path" = The relative path of the thing you want to request, normally starting with a backslash. E.g. "/index.php"
  679. ---
  680. --- mode = Controls how you want to receive the result. 0 for a plain string, 1 for a byte array (Lua table with numbers).
  681. ---
  682. --- The requested data will be received with a delay. This is because it is sent over the network. You have to use the httpdata-hook to handle the incoming data!
  683. ---
  684. --- The command will return a unique ID for the request. The same ID will be passed to the httpdata-hook so you can match request and response.
  685. --- @param url string
  686. --- @param path string
  687. --- @param mode 0 | 1
  688. --- @return number
  689. function reqhttp(url, path, mode)end
  690.  
  691. --- Sets the AI state value of the entity at tile position (x|y). The AI state of each entity is automatically set to 0 on each round start.
  692. ---
  693. --- CS2D does not actively use the AI state and you can set it to any integer value you want.
  694. ---
  695. --- It's commonly used in AI scripts (bots) only.
  696. ---
  697. --- e.g.: when a bomb has been planted, bots can mark a bomb spot as checked ("bomb is not here") using the AI state. This can be used to prevent that the same spot is checked again.
  698. --- @param x number
  699. --- @param y number
  700. --- @param ai number
  701. function setentityaistate(x, y, ai)end
  702.  
  703. --- Enables(1)/Disables(0) a hook completely. A disabled hook does not execute the attached Lua functions anymore.
  704. --- @param hook HookValue
  705. --- @param enable 0 | 1
  706. function sethookstate(hook, enable)end
  707.  
  708. --- Returns stats for a U.S.G.N. account ID.
  709. --- @param usgnid number
  710. --- @param value StatsValue
  711. --- @return boolean | number
  712. function stats(usgnid, value)end
  713.  
  714. --- Returns stats for a Steam account ID (provided as string)
  715. --- @param steamid string
  716. --- @param value StatsValue
  717. --- @return boolean | number
  718. function steamstats(steamid, value)end
  719.  
  720. --- Returns a value of the tile at the tile position (X|Y)
  721. ---
  722. --- Property Types:
  723. --- ---
  724. ---
  725. --- * 0-tile w/o sound
  726. ---
  727. --- * 1-wall
  728. ---
  729. --- * 2 - obstacle
  730. ---
  731. --- * 3 - wall w/o shadow
  732. ---
  733. --- * 4 - obstacle w/o shadow
  734. ---
  735. --- * 5 - floor wall
  736. ---
  737. --- * 10 - dirt floor
  738. ---
  739. --- * 11 - snow floor
  740. ---
  741. --- * 12 - step floor
  742. ---
  743. --- * 13 - tile floor
  744. ---
  745. --- * 14 - wade floor
  746. ---
  747. --- * 15 - metal floor
  748. ---
  749. --- * 16 - wood floor
  750. ---
  751. --- * 50 - deadly
  752. ---
  753. --- * 51 - toxic deadly
  754. ---
  755. --- * 52 - explosion deadly
  756. ---
  757. --- * 53 - abyss deadly
  758. --- @param x number
  759. --- @param y number
  760. --- @param value TileValue
  761. --- @return string | boolean | number
  762. function tile(x, y, value)end
  763.  
  764. --- Gets the property value for the specified tileFrame in the tileset of the current map.
  765. ---
  766. --- The returned property value describes the behaviour of the tile.
  767. ---
  768. --- Note: Will return 0 if you specify a tileFrame which is not part of the tileset!
  769. --- @param tileframe number
  770. --- @return TilePropertyType
  771. function tileproperty(tileframe)end
  772.  
  773. --- Creates a timer which will call the Lua function "function" after a certain time in milliseconds (time).
  774. ---
  775. --- Moreover it can pass an optional string parameter ("param") to this function.
  776. ---
  777. --- The timer calls the function once by default. However you can call it several times by entering the optional count parameter (count).
  778. ---
  779. --- Using 0 or negative count values will make the timer call the function infinite times or until it is removed via freetimer.
  780. ---
  781. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  782. --- @param time number
  783. --- @param func string
  784. --- @param param? string
  785. --- @param count? number
  786. function timer(time, func, param, count)end
  787.  
  788. --- Creates an alpha fade tween which changes the transparency of an image (with the specified ID).
  789. ---
  790. --- The image will have the given alpha transparency value after the given time!
  791. ---
  792. --- Alpha ranges from 0.0 (totally invisible) to 1.0 (completely opaque)
  793. ---
  794. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  795. --- @param id number
  796. --- @param time number
  797. --- @param alpha number
  798. function tween_alpha(id, time, alpha)end
  799.  
  800. --- Creates an animation tween which changes the frame of the spritesheet image with the specified id constantly.
  801. ---
  802. --- The speed defines how many milliseconds each frame should be displayed.
  803. ---
  804. --- You can also specify an animation mode:
  805. ---
  806. --- >0 - Loop Forward (play from current frame to last frame and then continue at first frame)
  807. ---
  808. --- >1 - Loop Backward (play from current frame to first frame and then continue at last frame)
  809. ---
  810. --- >2 - Ping Pong Forward (play forward to last frame and then backward to first frame etc.)
  811. ---
  812. --- >3 - Ping Pong Backward (play backward to first frame and then forward to last frame etc.)
  813. ---
  814. --- >4 - Random (an entirely random frame is displayed every speed milliseconds)
  815. ---
  816. --- The tween stays active until another tween_animate or tween_frame is applied to the same image.
  817. ---
  818. --- Note: Speed is specified in ms (milliseconds, 1000 ms = 1 sec)
  819. --- @param id number
  820. --- @param speed number
  821. --- @param mode ImageAnimationMode
  822. function tween_animate(id, speed, mode)end
  823.  
  824. --- Creates a color fade tween which changes the color of an image (with the specified ID).
  825. ---
  826. --- The image will have the given color after the given time (use a colorpicker to get the values)!
  827. ---
  828. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  829. --- @param id number
  830. --- @param time number
  831. --- @param r number
  832. --- @param g number
  833. --- @param b number
  834. function tween_color(id, time, r, g, b)end
  835.  
  836. --- Creates a frame animation tween which changes the frame of a spritesheet image (with the specified ID).
  837. ---
  838. --- The image will have the given frame after the given time.
  839. ---
  840. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  841. --- @param id number
  842. --- @param time number
  843. --- @param frame number
  844. function tween_frame(id, time, frame)end
  845.  
  846. --- Creates a movement tween which moves the image (with the specified ID) to x,y in the given time (+rotates it if rot is specified).
  847. ---
  848. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  849. --- @param id number
  850. --- @param time number
  851. --- @param x number
  852. --- @param y number
  853. --- @param rot? number
  854. function tween_move(id, time, x, y, rot)end
  855.  
  856. --- Creates a rotation tween which rotates the image (with the specified ID) to the angle rot in the given time.
  857. ---
  858. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  859. --- @param id number
  860. --- @param time number
  861. --- @param rot number
  862. function tween_rotate(id, time, rot)end
  863.  
  864. --- Creates a constant rotation animation which rotates an image (with the specified ID) permanently (negative speed for counter clockwise rotation)
  865. ---
  866. --- Note: The rotation doesn't end until another tween with rotation is applied!
  867. --- @param id number
  868. --- @param speed number
  869. function tween_rotateconstantly(id, speed)end
  870.  
  871. --- Creates a scale tween which changes the size of an image (with the specified ID). x will be the new width factor and y the new height factor after the given time.
  872. ---
  873. --- Note: Time is specified in ms (milliseconds, 1000 ms = 1 sec)
  874. --- @param id number
  875. --- @param time number
  876. --- @param x number
  877. --- @param y number
  878. function tween_scale(id, time, x, y)end
  879.  
  880. --- Shows Lua variables in the Lua main table in the console of CS2D. For debugging purposes only.
  881. function vars()end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement