Page:
GSC: New functions and methods
Clone
2
GSC: New functions and methods
JerryALT edited this page 2024-05-15 10:14:39 +00:00
Table of Contents
Introduction
if you are a beginner modder and don't know the difference between functions and methods then there will be a brief explanation.
Function - game command which doesn't request the entity for calling. You not need using the level.player or some entity for use this function, otherwise you get error about that function is not exists.
Example:
cinematic("cod_end");
earthquake(0.3, 3, self.origin, 850);
Methods - game command which request the entity, if you will not use the entity then you get the error about that method is not exists.
Methods have several categories:
- Player methods
- AI methods
- Vehicle methods
Example:
level.player allowAds(false);
: Player methodif (self canSee(player))
: AI methodbomber attachPath(aBomberPaths[i]);
: Vehicle method
All examples was taken from here: Link
Mostly the new methods use the player only. Next, you can see the new features that have been added specifically for IW3SP-MOD and can't be called for stock game version.
Functions
Exec(<string> command)
: Executes a console commandToUpper(<string> text)
: Converts text to uppercase
Weapon
GetWeaponDamage(<string> weapon name)
: Gets damage from a specific weaponSetWeaponDamage(<string> weapon name, <int> value)
: Sets the damage for a specific weaponPlayViewmodelFX(<string> FX, <string> tag_name)
: Plays the FX on viewmodel weapon. Do not use loop FX, otherwise you can't delete this fx.
Example:
player_play_fx_test()
{
level._effect["flashlight"] = loadfx("misc/flashlight");
PlayViewmodelFX(level._effect["flashlight"], "tag_flash");
}
Discord
SetDiscordDetails(<string> detail_name)
: Sets the detail status in discord rpcSetDiscordState(<string> state_name)
: Sets the state status in discord rpcSetButtonInformation(<string> label, <string> url)
: Setup the second button in discord rpcSetDiscordImage(<string> image_url)
: Sets the image in discord rpc
Example:
main()
{
maps\_load::main();
wait 4;
// P.S: Localized strings also supported
SetDiscordDetails("I go sleep!");
SetDiscordState("I'm serious...");
SetButtonInformation("MEGA MOD (YouTube link)", "https://www.youtube.com/watch?v=2Z4m4lnjxkY");
SetDiscordImage("https://media.tenor.com/fym4GQjsCRcAAAAM/kekwtf.gif");
}
Player methods
AllowFire <bool value>
: Enables/Disables player fireIsReloading()
: Checks state if player is reloadingIsSprinting()
: Checks state if player is sprintingIsUsingNVG()
: Checks state if player is uses NVGIsMantling()
: Checks state if player is mantlingIsSwapping()
: Checks state if player is swapping the weapon