server gifts.AddPositiveEffect(string name, string description, number num, function func, function or nil req = nil)
Description
Registers a positive gift effect.
Arguments
1string name
- The effect's name in English.
2string description
- The effect's description. Translatable strings are also accepted.
3number num
- A number to substitute for
%iinside description (if ≥ 0)
4function func
- The function that grants the effect.
- A function with the condition for granting the effect; it must return
trueorfalse. Optional argument.
Example
Add a crowbar to the list of positive effects.
lua
gifts.AddPositiveEffect(
"give_crowbar",
"fazhunt.gifts.crowbar_received",
-1,
function(ply)
ply:Give("weapon_crowbar")
end,
function(ply)
-- Only grant it if the player doesn't have a crowbar yet
return not ply:HasWeapon("weapon_crowbar")
end
)