🪄Witchcraft
A unique witchcraft script using trusted whitelisted identifiers to allow an immersive magical experience.
Whitelisted Identifiers (config.lua)
Whitelist = {
['PUTIDHERE'] = {
AllowRevive = true, ChangeWeather = true, SmokeColor = { r = 217, g = 9, b = 64 }, -- rgb smoke color unique for that player.
Teleports = {
{label = 'Cemetery', icon = 'cross', coords = vec4(-1728.95, -193.12, 58.53, 13.87)},
{label = 'Hospital', icon = 'hospital', coords = vec4(-841.78, -1207.0, 6.45, 49.54)},
{label = 'Legion Square', icon = 'location-dot', coords = vec4(187.63, -953.0, 30.09, 155.34)},
}
},
},
-- ESX: 'char1:c37f85056e3025a8515ac804d394b9d801e0f7e1' | QB/QBX: 'RT67HUI0'
Spellbook
Spells = {
fire = { label = 'Cast Fire', desc = 'Set a person on fire briefly.', icon = 'fire', },
force = { label = 'Cast Force', desc = 'Force push a person back.', icon = 'hand-sparkles', },
stun = { label = 'Cast Stun', desc = 'Stun a player.', icon = 'bolt', },
trip = { label = 'Cast Clone Trip', desc = 'Send a player on a trip with clones chasing them.', icon = 'burst', },
levitation = { label = 'Cast Levitation', desc = 'Levitate yourself and meditate.', icon = 'wand-sparkles', },
},
-- Example of adding a new spell to the table above:
example = { label = 'Cast Example', desc = 'Do something', icon = 'wand-sparkles', },
-- Your spell function can be placed in cl_open.
function exampleSpell()
print('do something')
end
-- Adjust the event in cl_open.lua to adapt your new spell.
RegisterNetEvent('randol_witchcraft:client:castSpell', function(spell)
if GetInvokingResource() or not hasPlyLoaded() then return end
if spell == 'fire' then
fireSpell()
elseif spell == 'force' then
forceSpell()
elseif spell == 'stun' then
stunSpell()
elseif spell == 'trip' then
cloneTrip()
elseif spell == 'example' then -- added here using the key from the Spells table.
exampleSpell()
end
end)
Potions
-- Adding a new potion example to the config.lua
Potions = {
new_potion = {
restricted = true, -- Only a whitelist person can use it.
event = 'randol_witchcraft:client:useNewPotion', -- client event name for using your potion that gets invoked from server. Potion name will get passed in.
ingredients = { -- Used for crafting. You can remove the ingredients altogether or leave the table empty and it can still be crafted for free.
{ name = 'iron', amount = 1},
{ name = 'steel', amount = 2},
},
},
}
-- Event for your new potion which passes through the item name. Can be put in cl_open.
RegisterNetEvent('randol_witchcraft:client:useNewPotion', function(itemName)
if GetInvokingResource() then return end
print('using new potion')
end)
-- ox inventory new potion example
['new_potion'] = {
label = 'New Potion',
weight = 0,
consume = 0,
client = { image = 'new_potion.png', },
server = { export = 'randol_witchcraft.new_potion', },
description = 'This is a new potion.'
},
-- qb inventory new potion example
new_potion = { name = 'new_potion', label = 'New Potion', weight = 0, type = 'item', image = 'new_potion.png', unique = false, useable = true, shouldClose = true, description = 'A new potion' },
Set Weather
-- Must adapt this to your weathersync in sv_open.
function setWeather(weather)
-- insert your weather script export/event in here
if GetResourceState('randol_weather') == 'started' then
return exports.randol_weather:SetWeather(weather)
end
if GetResourceState('qb-weathersync') == 'started' then
return exports['qb-weathersync']:setWeather(weather)
end
lib.print.error('No weathersync resource provided? see sv_open.lua')
end
Last updated