Snippets
Example snippets from achievements to showcase usage.
Client-Side:
-- "Downtown" Visit Legion Square
RegisterNetEvent("pickle_rewards:playerLoaded", function() --When player loads in
CreateThread(function()
local center = vector3(199.3448, -930.9882, 30.6890) --Center of location
local radius = 200.0 --How big of a radius around center to trigger
while not exports.pickle_rewards:IsAchievementComplete("downtown") do --While the acievement is NOT complete
local coords = GetEntityCoords(PlayerPedId()) --Player's coords
if #(center - coords) < radius then --If player is within the radius
TriggerServerEvent("pickle_rewards:achievements:downtownVisited") --Reward the achievement.
break
end
Wait(5000)
end
end)
end)
Server-Side:
-- "Downtown" Visit Legion Square
RegisterNetEvent("pickle_rewards:achievements:downtownVisited", function() --The event triggered in above code line 9.
local source = source --sets source as source.
if exports.pickle_rewards:IsAchievementComplete(source, "downtown") then return end --if the achievement downtown is complete end function.
exports.pickle_rewards:SetObjectiveValue(source, "downtown", 1, 1) --sets the achievement downtown's 1st option(only one) to true(1).
end)
Last updated