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