Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from RedEM-RP/patch-1
Browse files Browse the repository at this point in the history
Patch 1
  • Loading branch information
kanersps authored Jul 5, 2020
2 parents 60b53b4 + 73cde0a commit f1c0634
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 94 deletions.
25 changes: 5 additions & 20 deletions client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,11 @@ AddEventHandler('redemrp_identity:SpawnCharacter', function()
TriggerEvent("redemrp_respawn:respawn", new)
end
else
SetEntityCoords(PlayerPedId(), Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z)
SetTimecycleModifier('Base_modifier')
SetEntityCoords(ped, Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z)
cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", Config.CameraLocation.x, Config.CameraLocation.y, Config.CameraLocation.z, 300.00, 0.00, 0.00, 100.00, false, 0)
PointCamAtCoord(cam2, Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z+200)
SetCamActiveWithInterp(cam2, cam, 900, true, true)
Citizen.Wait(900)

cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z+200, 300.00, 0.00, 0.00, 100.00, false, 0)
PointCamAtCoord(cam, Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z)
SetEntityCoords(ped, Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z)
SetCamActiveWithInterp(cam, cam2, 3700, true, true)
--SetEntityCoords(ped, Config.SpawnPoint.x, Config.SpawnPoint.y, Config.SpawnPoint.z)
Citizen.Wait(3700)
RenderScriptCams(false, true, 500, true, true)
FreezeEntityPosition(PlayerPedId(), false)
Citizen.Wait(500)
SetCamActive(cam, false)
DestroyCam(cam, true)
DestroyCam(cam2, true)
DestroyCam(cam3, true)
DisplayHud(true)
DisplayRadar(true)
Citizen.Wait(3000)
Expand Down Expand Up @@ -166,7 +151,7 @@ AddEventHandler('redemrp_identity:openSelectionMenu', function(characters,skins,
local type2
local type3
local type4
if skins[1] ~= nil then
if skins and skins[1] ~= nil then
type1 = json.decode(skins[1].skin).sex
skin1 = json.decode(skins[1].skin)
if clothes[1] then
Expand All @@ -185,7 +170,7 @@ AddEventHandler('redemrp_identity:openSelectionMenu', function(characters,skins,
loading = false,
})
end
if skins[2] ~= nil then
if skins and skins[2] ~= nil then
type2 = json.decode(skins[2].skin).sex
skin2 = json.decode(skins[2].skin)
if clothes[2] then
Expand All @@ -200,7 +185,7 @@ AddEventHandler('redemrp_identity:openSelectionMenu', function(characters,skins,
clothes2 = elementy
end
end
if skins[3] ~= nil then
if skins and skins[3] ~= nil then
type3 = json.decode(skins[3].skin).sex
skin3 = json.decode(skins[3].skin)
if clothes[3] then
Expand All @@ -215,7 +200,7 @@ AddEventHandler('redemrp_identity:openSelectionMenu', function(characters,skins,
clothes3 = elementy
end
end
if skins[4] ~= nil then
if skins and skins[4] ~= nil then
type4 = json.decode(skins[4].skin).sex
skin4 = json.decode(skins[4].skin)
if clothes[4] then
Expand Down
10 changes: 5 additions & 5 deletions html/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>
</div>

<div id="usuwacz">
<div id="remover">
</div>
<div id="main">
</div>
Expand Down Expand Up @@ -59,7 +59,7 @@
var body = document.getElementById('body');
var main = document.getElementById('main');
var creator = document.getElementById('creator');
var r = document.getElementById("usuwacz");
var r = document.getElementById("remover");
r.style.display = "none";
creator.style.visibility = 'hidden';

Expand All @@ -77,7 +77,7 @@
set = true;
free = i;
}
main.innerHTML += '<div class="char"><div class="fname">' + char.firstname +" "+ char.lastname +'</div><div class="money">' + char.money + "$ | " + char.gold +' G</div><button class="create" onclick="select(' + chid + ','+ i +')">GRAJ</button><button class="delete" onclick="confirm(' + chid + ')">Delete</button></div></div>';
main.innerHTML += '<div class="char"><div class="fname">' + char.firstname +" "+ char.lastname +'</div><div class="money">' + char.money + "$ | " + char.gold +' G</div><button class="create" onclick="select(' + chid + ','+ i +')">SELECT</button><button class="delete" onclick="confirm(' + chid + ')">Delete</button></div></div>';


}
Expand Down Expand Up @@ -115,10 +115,10 @@
r.style.display = "block";
r.innerHTML += "<div id='pewien'>Are you sure? This action cannot be undone!</div></br>";
r.innerHTML += "<button id='potwierdz' onclick='delet(" + id + ")'>Confirm</buton>";
r.innerHTML += "<button id='anuluj' onclick='anuluj()'>Cancel</button>";
r.innerHTML += "<button id='cancelDeletion' onclick='cancelDeletion()'>Cancel</button>";
}

function anuluj() {
function cancelDeletion() {
r.innerHTML = "";
r.style.display = "none";
}
Expand Down
105 changes: 36 additions & 69 deletions server/sv_main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
local identifierUsed = GetConvar('es_identifierUsed', 'steam')

local foundResources = {}
local neededResources = {"redemrp_skin"}

local detectNeededResources = function()
for k,v in ipairs(neededResources)do
if GetResourceMetadata(v, "fx_version", 0) then
foundResources[v] = true
end
end
end

detectNeededResources()

RegisterServerEvent("redemrp_identity:getCharacters")
AddEventHandler("redemrp_identity:getCharacters", function()
local _source = source
Expand All @@ -12,13 +25,19 @@ AddEventHandler("redemrp_identity:getCharacters", function()
end

MySQL.Async.fetchAll('SELECT * FROM characters WHERE `identifier`=@identifier;', {identifier = id}, function(result)
MySQL.Async.fetchAll('SELECT * FROM skins WHERE `identifier`=@identifier;', {identifier = id}, function(result2)
MySQL.Async.fetchAll('SELECT * FROM clothes WHERE `identifier`=@identifier;', {identifier = id}, function(result3)
TriggerClientEvent('redemrp_identity:openSelectionMenu', _source, result, result2, result3)


if(foundResources.redemrp_skin)then
MySQL.Async.fetchAll('SELECT * FROM skins WHERE `identifier`=@identifier;', {identifier = id}, function(result2)
if(foundResources.redemrp_clothing)then
MySQL.Async.fetchAll('SELECT * FROM clothes WHERE `identifier`=@identifier;', {identifier = id}, function(result3)
TriggerClientEvent('redemrp_identity:openSelectionMenu', _source, result, result2, result3)
end)
else
TriggerClientEvent('redemrp_identity:openSelectionMenu', _source, result, result2, {})
end
end)
end)
else
TriggerClientEvent('redemrp_identity:openSelectionMenu', _source, result, {}, {})
end
end)


Expand All @@ -34,64 +53,9 @@ AddEventHandler("redemrp_identity:deleteCharacter", function(_charid, Callback)
end
end

MySQL.Async.fetchAll('DELETE FROM characters WHERE `identifier` = @identifier AND `characterid`=@characterid;', {identifier = id, characterid=_charid}, function(result)
if result then
else
end
end)
MySQL.Async.fetchAll('DELETE FROM horses WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)
MySQL.Async.fetchAll('DELETE FROM player_animals WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)
MySQL.Async.fetchAll('DELETE FROM status WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)


MySQL.Async.fetchAll('DELETE FROM coaches WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)


MySQL.Async.fetchAll('DELETE FROM horse_components WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)

MySQL.Async.fetchAll('DELETE FROM mail_cases WHERE `owner` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)

MySQL.Async.fetchAll('DELETE FROM notebook WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)

MySQL.Async.fetchAll('DELETE FROM player_animals WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)

MySQL.Async.fetchAll('DELETE FROM user_locker WHERE `identifier` = @identifier AND `charid`=@charid;', {identifier = id, charid=_charid}, function(result)
if result then
else
end
end)
MySQL.Async.fetchAll('DELETE FROM characters WHERE `identifier` = @identifier AND `characterid`=@characterid;', {identifier = id, characterid=_charid}, function(result)end)

TriggerEvent("redemrp_identity:characterRemoved", _source, id, _charid)

TriggerEvent('redemrp_db:getCurrentGang', id, _charid, function(user)
if user ~= false and tonumber(user.ganggrade) >= 10 then
Expand All @@ -106,11 +70,14 @@ AddEventHandler("redemrp_identity:deleteCharacter", function(_charid, Callback)
end
end)
end
end)
Wait(1000)
MySQL.Async.fetchAll('DELETE FROM gang WHERE `identifier` = @identifier AND `characterid`=@characterid;', {identifier = id, characterid=_charid}, function(result)
if result then
else

if user then
Wait(1000)
MySQL.Async.fetchAll('DELETE FROM gang WHERE `identifier` = @identifier AND `characterid`=@characterid;', {identifier = id, characterid=_charid}, function(result)
if result then
else
end
end)
end
end)

Expand Down

0 comments on commit f1c0634

Please sign in to comment.