mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 14:26:03 +01:00
fix(events): preventing cheats
This commit is contained in:
@@ -34,7 +34,7 @@ AddEventHandler("onResourceStart", function(resourceName)
|
|||||||
if (GetCurrentResourceName() ~= resourceName) then
|
if (GetCurrentResourceName() ~= resourceName) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
MySQL.query("CREATE TABLE IF NOT EXISTS characters ( `character_id` INT(10) NOT NULL AUTO_INCREMENT, `license` VARCHAR(200) NOT NULL DEFAULT '0', `first_name` VARCHAR(50) NULL DEFAULT NULL, `last_name` VARCHAR(50) NULL DEFAULT NULL, `dob` VARCHAR(50) NULL DEFAULT NULL, `gender` VARCHAR(50) NULL DEFAULT NULL,`twt` VARCHAR(50) NULL DEFAULT NULL, `job` VARCHAR(50) NULL DEFAULT NULL, `cash` INT(10) NULL DEFAULT '0', `bank` INT(10) NULL DEFAULT '0', `phone_number` VARCHAR(20) NULL DEFAULT NULL, `groups` LONGTEXT NULL DEFAULT '[]', `last_location` LONGTEXT NULL DEFAULT '[]', `clothing` LONGTEXT NULL DEFAULT '[]', PRIMARY KEY (`character_id`) USING BTREE);")
|
MySQL.query("CREATE TABLE IF NOT EXISTS characters ( `character_id` INT(10) NOT NULL AUTO_INCREMENT, `license` VARCHAR(200) NOT NULL DEFAULT '0', `first_name` VARCHAR(50) NULL DEFAULT NULL, `last_name` VARCHAR(50) NULL DEFAULT NULL, `dob` VARCHAR(50) NULL DEFAULT NULL, `gender` VARCHAR(50) NULL DEFAULT NULL, `twt` VARCHAR(50) NULL DEFAULT NULL, `job` VARCHAR(50) NULL DEFAULT NULL, `cash` INT(10) NULL DEFAULT '0', `bank` INT(10) NULL DEFAULT '0', PRIMARY KEY (`character_id`) USING BTREE);")
|
||||||
print('^4ND_Core ^0Database structure validated!')
|
print('^4ND_Core ^0Database structure validated!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -53,6 +53,8 @@ end)
|
|||||||
-- Update the character info when edited.
|
-- Update the character info when edited.
|
||||||
RegisterNetEvent("ND:editCharacter", function(newCharacter)
|
RegisterNetEvent("ND:editCharacter", function(newCharacter)
|
||||||
local player = source
|
local player = source
|
||||||
|
local characters = NDCore.Functions.GetPlayerCharacters(player)
|
||||||
|
if not characters[newCharacter.id] then return end
|
||||||
NDCore.Functions.UpdateCharacterData(newCharacter.id, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job)
|
NDCore.Functions.UpdateCharacterData(newCharacter.id, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -67,6 +69,8 @@ end)
|
|||||||
-- add a player to the table.
|
-- add a player to the table.
|
||||||
RegisterNetEvent("ND:setCharacterOnline", function(id)
|
RegisterNetEvent("ND:setCharacterOnline", function(id)
|
||||||
local player = source
|
local player = source
|
||||||
|
local characters = NDCore.Functions.GetPlayerCharacters(player)
|
||||||
|
if not characters[id] then return end
|
||||||
NDCore.Functions.SetActiveCharacter(player, id)
|
NDCore.Functions.SetActiveCharacter(player, id)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -83,6 +87,7 @@ AddEventHandler("playerDropped", function()
|
|||||||
if character then
|
if character then
|
||||||
NDCore.Functions.UpdateLastLocation(character.id, character.lastLocation)
|
NDCore.Functions.UpdateLastLocation(character.id, character.lastLocation)
|
||||||
end
|
end
|
||||||
|
TriggerEvent("ND:characterUnloaded", player)
|
||||||
character = nil
|
character = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user