diff --git a/GSC%3A-New-functions-and-methods.md b/GSC%3A-New-functions-and-methods.md new file mode 100644 index 0000000..6473301 --- /dev/null +++ b/GSC%3A-New-functions-and-methods.md @@ -0,0 +1,72 @@ +# 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 method +* ``if (self canSee(player))``: AI method +* ``bomber attachPath(aBomberPaths[i]);``: Vehicle method + +> All examples was taken from here: [Link](https://docs.raid-gaming.net/cod4) + +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( command)``: Executes a console command +* ``ToUpper( text)``: Converts text to uppercase + +## Weapon +* ``getweapondamage( weapon name)``: Gets damage from a specific weapon +* ``setweapondamage( weapon name, value)``: Sets the damage for a specific weapon +* ``PlayViewmodelFX( FX, tag_name)``: Plays the FX on viewmodel weapon. Do not use loop FX, otherwise you can't delete this fx. + +Example: +```c +player_play_fx_test() +{ + level._effect["flashlight"] = loadfx("misc/flashlight"); + PlayViewmodelFX(level._effect["flashlight"], "tag_flash"); +} +``` + +## Discord +* ``setdiscorddetails( detail_name)``: Sets the detail status in discord rpc +* ``setdiscordstate( state_name)``: Sets the state status in discord rpc +* ``setbuttoninformation( label, url)``: Setup the second button in discord rpc +* ``setdiscordimage( image_url)``: Sets the image in discord rpc + +Example: +```c +main() +{ + maps\_load::main(); + wait 4; + // 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 ``: Enables/Disables player fire +* ``IsReloading()``: Checks state if player is reloading +* ``IsSprinting()``: Checks state if player is sprinting +* ``IsUsingNVG()``: Checks state if player is uses NVG +* ``isMantling()``: Checks state if player is mantling +* ``isSwapping()``: Checks state if player is swapping the weapon +