mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
Update main.lua
Added database spam prevention
This commit is contained in:
@@ -93,6 +93,8 @@ RegisterNetEvent("newCharacter")
|
||||
AddEventHandler("newCharacter", function(newCharacter)
|
||||
local player = source
|
||||
local license = GetPlayerIdentifierFromType("license", player)
|
||||
exports.oxmysql:execute("SELECT character_id FROM characters WHERE license = ?", {GetPlayerIdentifierFromType("license", player)}, function(result)
|
||||
if (result) and (config.characterLimit > #result) then
|
||||
exports.oxmysql:execute("SELECT MAX(character_id) AS nextID FROM characters WHERE license = ?", {license}, function(result)
|
||||
if result then
|
||||
character_id = result[1].nextID
|
||||
@@ -108,6 +110,8 @@ AddEventHandler("newCharacter", function(newCharacter)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Delete character from database.
|
||||
|
||||
Reference in New Issue
Block a user