Security HUD
System Watchdog
×
Threads Scanned
-- / --
SYS. LOAD --%
AI SHIELD ACTIVE
DMCA Policy
×

📋 DMCA Compliance

This platform and community fully complies with the Digital Millennium Copyright Act (DMCA) and international copyright laws. We take all copyright protection seriously.

🛡️ Copyright Protection

If you believe a posted item belongs to you or violates your copyright, you may file a DMCA takedown request through our official channels. Upon receiving a valid claim, the infringing content will be removed within 24 hours.

What's new
×
Fiveguard

Guide Don't Have Player Grant Items After Registering.

Respown

Gold Elite
Joined
Aug 3, 2021
Messages
192
Solutions
1
Reaction score
98,700
Points
306
Location
root
I made it for a client last time, anyone who needs it. Maybe I'll leave it here for those who ask what exactly is its function, if the person has not entered the firstname and lastname information in the users table, that is, if he is unregistered, he will check this at the first login and add the items on the person.

- Add to client.lua side of any script.

Code:
AddEventHandler('playerSpawned', function()
    ExecuteCommand("ipara")
end)

- Add to server.lua side of any script.
Code:
RegisterCommand("ipara", function(source)

 

    local xPlayer = ESX.GetPlayerFromId(source)



    local result = exports.ghmattimysql:executeSync("SELECT identifier, firstname, lastname FROM `users` WHERE `identifier` = @identifier", {

        ["@identifier"] = xPlayer.identifier

    })



    if result[1].firstname == "" or result[1].lastname == "" then

    TriggerEvent("fivemac:baslangic",source)

    else

    return

    end

    end)



local itemsMoney = {

    ["itemtype"] = "cash", -- "para item olarak mı default ayar kalsın."

    ["amount"] = tonumber(5000), -- "üstüne eklenicek para miktarı"

}



local standartItems = { -- "üstüne eklenicek standart itemler"

    [1] = "wallet",

    [2] = "bankcard",

    [3] = "phone",

}



RegisterServerEvent("fivemac:baslangic")

AddEventHandler('fivemac:baslangic', function(source)



local player = ESX.GetPlayerFromId(source)

for k,v in pairs (standartItems) do

player.addInventoryItem(standartItems[k], 1)

TriggerClientEvent("inventory:client:ItemBox",source, ESX.GetItems("fivemac")[standartItems[k]],'add','1')

end

 

if itemsMoney["itemtype"] == "cash" then

TriggerClientEvent("inventory:client:ItemBox",source, ESX.GetItems("fivemac")[itemsMoney["itemtype"]],'add',itemsMoney["amount"])

player.addInventoryItem(itemsMoney["itemtype"], itemsMoney["amount"])

end

end)
 
Top