🗽EZ Life Style
Allow players to select the life style they want and integrate their choice into other scripts. Give starter items based on player interests, and start them in a location occurring to their lifestyle.
STEP 1 - Unzip and Add Script To Server
Unzip the script folder within your server resources folder. Ensure script in server.cfg ... "ensure ez_lifestyle".
STEP 2 - Modify Character Creation
Go to vorp_character/server/server.lua
and search for the event "vorpcharacter:saveCharacter". Change/ modify it to add the following code:
-- Check if resourse ez_lifestyle is running
local function CheckLifeStyle()
if GetResourceState("ez_lifestyle") == "started" then
return true
end
return false
end
RegisterServerEvent("vorpcharacter:saveCharacter", function(data)
local _source = source
Core.getUser(_source).addCharacter(data)
Wait(600)
local iniPos, iniHead = iniSpawn()
if CheckLifeStyle() then
TriggerClientEvent("ez_lifeStyle:openStyles", _source, iniPos, iniHead)
else
TriggerClientEvent("vorp:initCharacter", _source, iniPos, iniHead, false)
end
SetTimeout(3000, function()
TriggerEvent("vorp_NewCharacter", _source)
end)
end)
Just in case if you ever want to remove the script, you do not have to worry about removing the code, as we have made use of the function CheckLifeStyle() to check if the resource is running or not.
If you have renamed the script, make sure to change the name of the resource in the function CheckLifeStyle().
2. Run the SQL file in your database.
STEP 3 - Run SQL
Create the attribute.
ALTER TABLE `characters`
ADD `lifestyle` VARCHAR(50) DEFAULT NULL;
[OPTIONAL] STEP 4 - Removing existing starter items & money
Make sure to remove default cash for new players from vorp_core/config.lua
. Furthermore, make sure to remove any default items and weapons from the vorp_inventory/config.lua
.
Last updated
Was this helpful?