Skip to main content

Exported Classes

Example usage of the Instance class
import { Instance } from "cspointscript"

Instance.Msg("Hello, world!")

Instance

NameSignatureDescription
Instance.MsgMsg(message: string | number | boolean): voidSends a message to the server console.
Instance.PublicMethodPublicMethod(methodName: string, method: (input: T) => void): voidDefines a public method that can be called from the I/O system in the map. To pass a value into the method, it must have a type specified. For example: PublicMethod("MyMethod", (input: string) => { ... }) Right now no matter what the input type is declared as, it will always be a string. So it will require manual casting to the correct type.
Instance.GetGameTimeGetGameTime(): numberGets the current game time in seconds from when the map started.
Instance.GameTypeGameType(): 0 | 1 | 2 | 3 | 4 | 5 | 6Gets the current game type. 0 = Classic 1 = Gun Game 2 = Training 3 = Custom 4 = Cooperative 5 = Skirmish 6 = Free For All
Instance.GameModeGameMode(): 0 | 1 | 2 | 3 | 4Gets the current game mode. 0 = Casual (When gametype = 0), Arms Race (When gametype = 1), Training (When gametype = 2), Custom (When gametype = 3), Guardian (When gametype = 4), War Games (When gametype = 5), Danger Zone (When gametype = 6) 1 = Competitive (When gametype = 0), Demolition (When gametype = 1), Co-op Strike (When gametype = 4) 2 = Wingman (When gametype = 0), Deathmatch (When gametype = 1) 3 = Weapons Expert 4 = Training Day
Instance.IsWarmupPeriodIsWarmupPeriod(): booleanReturns true if the game is in a warmup period.
Instance.GetPlayerPawnGetPlayerPawn(playerId: string | number | boolean): Pawn | undefinedGets a player Pawn handle by their player slot.
Instance.GetEntityOriginGetEntityOrigin(entity: Entity | Pawn): [number, number, number]Gets the origin of a entity.
Instance.EntFireAtNameEntFireAtName(entityName: string, action: string, value: string | number | boolean, delay: number): voidTriggers an action on an entity.
Instance.DebugScreenTextDebugScreenText(message: string, flScreenX: number, flScreenY: number, nTextOffset: number, flDuration: number, color: unknown): voidPrints a message to the screen.
Instance.EntFireBroadcastEntFireBroadcast(target: string, operation: string, value: string | number | boolean, delay: number): voidTriggers an action on an entity.
Instance.InitialActivateInitialActivate(func: () => void): voidRuns a function once the script as finished loading.

ClientInstance

NameSignatureDescription
ClientInstance.SetNextClientThinkSetNextClientThink(number: number): voidNeeds testing.
ClientInstance.ClientThinkClientThink(func: () => void): voidNeeds testing.

Entity

NameSignatureDescription
Entity.GetAbsOriginGetAbsOrigin(): [number, number, number]Gets the absolute origin of the entity.
Entity.GetOriginGetOrigin(): [number, number, number]Gets the origin of the entity.
Entity.GetTeamNumberGetTeamNumber(): 3 | 2 | 1 | 0Gets the team number of the pawn. 0 = Team Selection 1 = Spectator 2 = Terrorist 3 = Counter-Terrorist

Pawn

NameSignatureDescription
Pawn.FindWeaponFindWeapon(sWeaponName: string): Weapon | undefinedFinds a weapon by name.
Pawn.FindWeaponBySlotFindWeaponBySlot(nSlot: 0 | 1 | 2): Weapon | undefinedFinds a weapon by slot.
Pawn.GetActiveWeaponGetActiveWeapon(): WeaponGets the currently active weapon.
Pawn.DestroyWeaponDestroyWeapon(pWeapon: Weapon): voidDestroys the weapon.
Pawn.DestroyWeaponsDestroyWeapons(): voidDestroys all weapons apart from the knife.
Pawn.SwitchToWeaponSwitchToWeapon(pWeapon: Weapon): voidSwitches to a weapon.
Pawn.SetGunGameImmunitySetGunGameImmunity(): unknownNeeds testing.
Pawn.SetGunGameImmunityColorSetGunGameImmunityColor(): unknownNeeds testing.
Pawn.GiveNamedItemGiveNamedItem(sName: string): voidGives an item to the player.
Pawn.GetCurrentControllerGetCurrentController(): ControllerGets the controller of the pawn.
Pawn.GetOriginalControllerGetOriginalController(): ControllerGets the controller of the pawn.
Pawn.GetAbsOriginGetAbsOrigin(): [number, number, number]Gets the absolute origin of the entity.
Pawn.GetOriginGetOrigin(): [number, number, number]Gets the origin of the entity.
Pawn.GetTeamNumberGetTeamNumber(): 3 | 2 | 1 | 0Gets the team number of the pawn. 0 = Team Selection 1 = Spectator 2 = Terrorist 3 = Counter-Terrorist
Pawn.ChangeTeamChangeTeam(iTeamNum: 3 | 2 | 1 | 0): voidSets the team of the pawn (This will kill the player).
Pawn.GetClassNameGetClassName(): stringGets the name of the pawn type.

Controller

NameSignatureDescription
Controller.GetPlayerGetPlayer(): PawnGets the pawn this controller controls.
Controller.GetObserverGetObserver(): ObserverGets the observer of this controller.
Controller.GetScoreGetScore(): numberGets the score of the controller.
Controller.AddScoreAddScore(nPoints: number): voidAdds score the to controller.
Controller.GetWeaponDataForLoadoutSlotGetWeaponDataForLoadoutSlot(nSlot: number): LoadoutWeaponData | undefinedGet the weapon data of the players loadout slot. 0 = weapon_knife_tactical 1 = weapon_c4 for Ts and undefined for CTs 2 = Starting Pistol 3 = Other Pistols 1 4 = Other Pistols 2 5 = Other Pistols 3 6 = Other Pistols 4 8 = Mid tier 1 9 = Mid tier 2 10 = Mid tier 3 11 = Mid tier 4 12 = Mid tier 5 14 = Rifles 1 15 = Rifles 2 16 = Rifles 3 17 = Rifles 4 18 = Rifles 5 25 = weapon_shield 26 = weapon_flashbang 27 = weapon_smokegrenade 28 = weapon_hegrenade 29 = weapon_molotov for Ts and weapon_incgrenade for CTs 30 = weapon_decoy 32 = item_kevlar 33 = item_assaultsuit 34 = weapon_taser
Controller.IsObservingIsObserving(): booleanReturns true if the controller is observing.
Controller.GetPlayerSlotGetPlayerSlot(): numberGet the player slot of the controller.
Controller.IsFakeClientIsFakeClient(): booleanReturns true if the controller is a bot.
Controller.GetAbsOriginGetAbsOrigin(): [number, number, number]Gets the absolute origin of the entity.
Controller.GetOriginGetOrigin(): [number, number, number]Gets the origin of the entity.
Controller.GetTeamNumberGetTeamNumber(): 3 | 2 | 1 | 0Gets the team number of the pawn. 0 = Team Selection 1 = Spectator 2 = Terrorist 3 = Counter-Terrorist
Controller.ChangeTeamChangeTeam(iTeamNum: 3 | 2 | 1 | 0): voidSets the team of the pawn (This will kill the player).
Controller.GetClassNameGetClassName(): stringGets the name of the entity.

Observer

NameSignatureDescription
Observer.GetObserverModeGetObserverMode(): numberNeeds testing.
Observer.SetObserverModeSetObserverMode(mode: number): unknownNeeds testing.
Observer.GetCurrentControllerGetCurrentController(): ControllerGets the controller of this observer.
Observer.GetAbsOriginGetAbsOrigin(): [number, number, number]Gets the absolute origin of the entity.
Observer.GetOriginGetOrigin(): [number, number, number]Gets the origin of the entity.
Observer.GetTeamNumberGetTeamNumber(): 3 | 2 | 1 | 0Gets the team number of the pawn. 0 = Team Selection 1 = Spectator 2 = Terrorist 3 = Counter-Terrorist
Observer.ChangeTeamChangeTeam(iTeamNum: 3 | 2 | 1 | 0): voidSets the team of the pawn (This will kill the player).
Observer.GetClassNameGetClassName(): stringGets the name of the entity.

Weapon

NameSignatureDescription
Weapon.GetDataGetData(): LoadoutWeaponDataGets the loadout data for this weapon.
Weapon.GetAbsOriginGetAbsOrigin(): [number, number, number]Gets the absolute origin of the entity.
Weapon.GetOriginGetOrigin(): [number, number, number]Gets the origin of the entity.
Weapon.GetTeamNumberGetTeamNumber(): 3 | 2 | 1 | 0Gets the team number of the pawn. 0 = Team Selection 1 = Spectator 2 = Terrorist 3 = Counter-Terrorist
Weapon.ChangeTeamChangeTeam(iTeamNum: 3 | 2 | 1 | 0): voidSets the team of the pawn (This will kill the player).
Weapon.GetClassNameGetClassName(): stringGets the name of the entity.

LoadoutWeaponData

NameSignatureDescription
LoadoutWeaponData.GetNameGetName(): numberGets the name of the weapon.
LoadoutWeaponData.GetTypeGetType(): numberGets the type of the weapon. 0 = knife 1 = pistol 2 = light machine gun 3 = rifle 4 = shotgun 5 = sniper 7 = c4 9 = grenade 10 = kevlar 19 = shield
LoadoutWeaponData.GetPriceGetPrice(): numberGets the price of the weapon.