Auto-sync 2026-04-15 22:50
This commit is contained in:
parent
f148a720da
commit
a2ccf2ad11
@ -70,6 +70,14 @@ end
|
||||
|
||||
RegisterNetEvent('mercyv-bike:syncNPC', function(data)
|
||||
NPCData = data
|
||||
if not data then
|
||||
-- NPC löschen
|
||||
if NPCEntity and DoesEntityExist(NPCEntity) then
|
||||
DeleteEntity(NPCEntity)
|
||||
NPCEntity = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
SpawnNPC(data)
|
||||
end)
|
||||
|
||||
@ -284,3 +292,8 @@ RegisterCommand('bikeadmin', function()
|
||||
Citizen.Wait(200)
|
||||
SendNUIMessage({ action = "OPEN_ADMIN", isAdmin = true })
|
||||
end, false)
|
||||
|
||||
RegisterNUICallback('deleteNPC', function(data, cb)
|
||||
TriggerServerEvent('mercyv-bike:deleteNPC')
|
||||
cb({})
|
||||
end)
|
||||
|
||||
@ -178,6 +178,15 @@ body {
|
||||
.mb-save-btn:hover { background: var(--accent-hover); }
|
||||
.mb-save-btn:active { transform: scale(0.98); }
|
||||
|
||||
.mb-delete-btn {
|
||||
padding: 12px 16px; border-radius: 8px;
|
||||
background: rgba(220,50,50,0.15);
|
||||
border: 1px solid rgba(220,50,50,0.3);
|
||||
color: #e05555; font-size: 14px; font-family: "GilroyBold", sans-serif;
|
||||
cursor: pointer; transition: background 0.15s;
|
||||
}
|
||||
.mb-delete-btn:hover { background: rgba(220,50,50,0.28); }
|
||||
|
||||
.mb-admin-hint {
|
||||
display: flex; align-items: flex-start; gap: 8px;
|
||||
padding: 10px 12px;
|
||||
@ -298,9 +307,14 @@ body {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button class="mb-save-btn" v-on:click="saveNPC()">
|
||||
<div style="display:flex; gap:8px;">
|
||||
<button class="mb-save-btn" style="flex:1;" v-on:click="saveNPC()">
|
||||
<i class="fas fa-save"></i> Speichern
|
||||
</button>
|
||||
<button class="mb-delete-btn" v-on:click="deleteNPC()">
|
||||
<i class="fas fa-trash"></i> NPC löschen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-admin-hint">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
@ -376,6 +390,10 @@ var app = new Vue({
|
||||
captureSpawn: function() {
|
||||
postNUI('capturePos', { field: 'spawn' });
|
||||
},
|
||||
deleteNPC: function() {
|
||||
postNUI('deleteNPC', {});
|
||||
this.closeAdmin();
|
||||
},
|
||||
saveNPC: function() {
|
||||
postNUI('saveNPC', {
|
||||
model: this.npc.model,
|
||||
|
||||
@ -199,3 +199,13 @@ RegisterCommand('bikereset', function(src, args)
|
||||
Config.ServerNotification(src, 'Claim von Spieler ' .. targetId .. ' zurückgesetzt.', 'success')
|
||||
Config.ServerNotification(targetId, 'Dein Fahrrad-Claim wurde zurückgesetzt.', 'info')
|
||||
end, false)
|
||||
|
||||
RegisterNetEvent('mercyv-bike:deleteNPC', function()
|
||||
local src = source
|
||||
if not IsAdmin(src) then return end
|
||||
MySQL.update('DELETE FROM mercyv_bike_npc')
|
||||
NPCData = nil
|
||||
SpawnData = nil
|
||||
TriggerClientEvent('mercyv-bike:syncNPC', -1, nil)
|
||||
Config.ServerNotification(src, "NPC gelöscht.", "success")
|
||||
end)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user