Pickle Mods
  • Pickle Mods
  • Paid Resources
    • Casinos
      • Installation
      • Tutorial
    • In-Game Store
      • Installation
      • Exports
      • Tebex & Coin Products
      • PTS Commands
    • Rewards System
      • Installation
      • Exports
      • Snippets
    • Bail & Bounty
      • Installation
      • Exports
    • Firefighter Job
      • Installation
      • Commands
      • Exports
      • Snippets
    • Advanced Crafting
      • Installation
    • Electrician Job
      • Installation
    • Construction Job
      • Installation
    • Hunting
      • Installation
    • Documents
      • Installation
      • Exports & Examples
    • Dealership
      • Installation
    • Police Tools
      • Installation
  • Free Resources
    • Pickle Airport
      • Installation
      • Hotfixes
    • Pickle Consumables
      • Installation
      • Hotfixes
    • Pickle Farming
      • Installation
    • Pickle Metal Detector
      • Installation
    • Pickle Payments
      • Installation
    • Pickle Prisons
      • Installation
      • Commands
      • Exports
      • Events
      • Snippets
    • Pickle Rentals
      • Installation
    • Pickle Slapboxing
      • Installation
    • Pickle Taxi Job
      • Installation
    • Waypoints
      • Installation
      • Exports
Powered by GitBook
On this page
  • Client-Side:
  • Server-Side:
  1. Paid Resources
  2. Rewards System

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)
PreviousExportsNextBail & Bounty

Last updated 1 year ago