Loading function...
Please make sure JavaScript is enabled. Otherwise you will be unable to see the function documentation.
Please make sure JavaScript is enabled. Otherwise you will be unable to see the function documentation.
Load a config file given a relative path. A valid Config object is always returned, even if it is missing. It will just behave like an empty config file. You can check if a config is missing using IsConfigMissing.
Use a config file to allow the user to customize the behavior of your mod.
function MissionSetup()
-- load config with the button for our move
local cfg = LoadConfigFile("fighting_moves.txt")
gKickButton = GetConfigNumber(cfg, "kick_button", 8)
end
function main()
while not SystemIsReady() do
Wait(0)
end
while true do
local target = PedGetTargetPed(gPlayer)
if PedIsValid(target) and PedIsInCombat(target) and PedMePlaying(gPlayer, "Default_KEY", true) then
-- only allow fighting moves when it is appropriate
if IsButtonBeingPressed(gKickButton, 0) then
PedSetActionNode(gPlayer, "/Global/G_Grappler_A/Offense/Short/Strikes/HeavyAttacks/BootKick", "Act/Anim/G_Grappler_A.act")
end
end
Wait(0)
end
end
Returns the Config object belonging to the current collection. It will behave just like the one returned by LoadConfigFile.
None.
DSL4 This function was introduced, but was poorly implemented and would cause crashes.
DSL5 This function now works as intended.
Since LoadConfigFile still returns a valid Config object when the requested config doesn't exist, you will need to use this function to check if it actually exists or not.
Return the raw value associated with Key as a string. If there is no value, Default will be returned (if given).
Return the value associated with Key as a string. If there is no value, Default will be returned (if given).
Unlike GetConfigValue, this function will strip away quotation marks from the string if there are any.
Return the number associated with Key if it can be converted. Otherwise, Default will be returned (if given).
The number can be expressed using hexadecimal if it is preceded by 0x in the config.
Return if the value under Key is not false. If there is no value, Default will be returned (if given).
WARNING This function has been deprecated, but still works to preserve legacy support. Consider using GetConfigString.
Similar to GetConfigValue, except it will strip the quotation marks from Value and is capable of returning multiple values seperated by a comma (,). If there is no value associated with Key, all the extra values passed to the function are returned instead.
Returns an iterator function designed for use in a for loop that returns each value associated with Key.
Give the player each weapon listed in a gConfig, which is presumed to already exist as a Config object.
for weapon in AllConfigValues(gConfig, "weapon_model") do
local model = tonumber(weapon)
if model then
PedSetWeapon(gPlayer, 50)
else
PrintWarning("expected number for weapon ("..weapon..")")
end
end
# list as many weapon models as you want to be used with AllConfigValues
weapon_model 301 # fire crackers
weapon_model 305 # spud gun
weapon_model 307 # bottle rocket launcher
Similar to AllConfigValues, except it also parses each value like GetConfigString would.
DSL5 Only one string can be returned per config line instead of multiple.