Skip to content

Commit

Permalink
fix: add notifications to commands
Browse files Browse the repository at this point in the history
  • Loading branch information
BerkieBb committed May 8, 2024
1 parent 4351fcb commit 065a5f1
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 43 deletions.
9 changes: 6 additions & 3 deletions locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Krádež auta se nezdařila!",
"failed_lockedpick": "Nedaří se vám najít klíče a jste zklamaní.",
"fpid": "Vyplňte ID hráče a SPZ",
"gave_keys": "Předáš klíče.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Dostanete klíčky od vozidla!",
"no_keys": "Od tohoto vozidla nemáte klíče.",
"not_near": "V blízkosti není nikdo, komu by bylo možné předat klíče",
"vehicle_locked": "Vozidlo je zamčené!",
"vehicle_lockedpick": "Podařilo se ti otevřít zámek dveří!",
"vehicle_unlocked": "Vozidlo odemčeno!"
"vehicle_unlocked": "Vozidlo odemčeno!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Pokus o krádež auta...",
"searching_keys": "Hledání klíčů od auta...",
"takekeys": "Odebírání klíčů z těla..."
}
}
}
9 changes: 6 additions & 3 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Knacken des Autos ist fehlgeschlagen!",
"failed_lockedpick": "Du kannst keine Schlüssel finden und bist frustriert.",
"fpid": "Gebe die Bürger-ID und das Kennzeichen an.",
"gave_keys": "Du gibst die Schlüssel ab.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Du erhälst die Schlüssel für das Fahrzeug!",
"no_keys": "Du hast keine Schlüssel für das Fahrzeug!",
"not_near": "Es ist niemand in der Nähe, der den Schlüssel bekommen könnte!",
"vehicle_locked": "Fahrzeug verriegelt!",
"vehicle_lockedpick": "Du hast es geschafft, das Türschloss zu knacken!",
"vehicle_unlocked": "Fahrzeug entriegelt."
"vehicle_unlocked": "Fahrzeug entriegelt.",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Versuchter Autodiebstahl...",
"searching_keys": "Suche nach Fahrzeugschlüssel...",
"takekeys": "Fahrzeugschlüssel abnehmen..."
}
}
}
9 changes: 6 additions & 3 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Carjacking failed!",
"failed_lockedpick": "You fail to find the keys and get frustrated.",
"fpid": "Fill out the player ID and Plate arguments",
"gave_keys": "You hand over the keys.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "You get keys to the vehicle!",
"no_keys": "You don't have keys to this vehicle.",
"not_near": "There is nobody nearby to hand keys to",
"vehicle_locked": "Vehicle locked!",
"vehicle_lockedpick": "You managed to pick the door lock open!",
"vehicle_unlocked": "Vehicle unlocked!"
"vehicle_unlocked": "Vehicle unlocked!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Attempting Carjacking...",
"searching_keys": "Searching for the car keys...",
"takekeys": "Taking keys from body..."
}
}
}
9 changes: 6 additions & 3 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "¡Robo de carro falló!",
"failed_lockedpick": "No logras encontrar las llaves y te frustras",
"fpid": "Llena los argumentos de ID y placa del jugador",
"gave_keys": "Has entregado las llaves",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Has recibido las llaves del vehículo",
"no_keys": "No tienes las llaves de este vehículo",
"not_near": "No hay nadie cerca a quién darle las llaves",
"vehicle_locked": "Vehículo cerrado",
"vehicle_lockedpick": "Lograste abrir la cerradura",
"vehicle_unlocked": "Vehículo abierto"
"vehicle_unlocked": "Vehículo abierto",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Intentando robar carro...",
"searching_keys": "Buscando las llaves del carro...",
"takekeys": "Obteniendo las llaves del cuerpo..."
}
}
}
9 changes: 6 additions & 3 deletions locales/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Autovargamine ebaõnnestus!",
"failed_lockedpick": "Te ei leia võtmeid ja olete pettunud.",
"fpid": "Täitke mängija ID ja plaadi argumendid",
"gave_keys": "Annad võtmed üle.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Saate auto võtmed!",
"no_keys": "Teil pole selle sõiduki võtmeid.",
"not_near": "Läheduses pole kedagi, kellele võtmed kätte anda",
"vehicle_locked": "Sõiduk lukus!",
"vehicle_lockedpick": "Sul õnnestus ukselukk lahti keerata!",
"vehicle_unlocked": "Sõiduk avatud!"
"vehicle_unlocked": "Sõiduk avatud!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Autovarguse katse...",
"searching_keys": "Autovõtmete otsimine...",
"takekeys": "Võtmete kehast võtmine..."
}
}
}
9 changes: 6 additions & 3 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Le détournement de voiture a échoué",
"failed_lockedpick": "Vous n'avez pas réussi à ouvrir le véhicule et vous êtes frustré.",
"fpid": "Remplissez les arguments ID et plaque.",
"gave_keys": "Vous donnez les clés.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Vous obtenez les clés du véhicule!",
"no_keys": "Vous n'avez pas de clés de ce véhicule.",
"not_near": "Il n'y a personne à proximité.",
"vehicle_locked": "Véhicule verrouillé!",
"vehicle_lockedpick": "Vous avez réussi à ouvrir le véhicule!",
"vehicle_unlocked": "Véhicule déverrouillé!"
"vehicle_unlocked": "Véhicule déverrouillé!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Tentative de vol de carjack..",
"searching_keys": "Cherche les clés du véhicule..",
"takekeys": "Prend les clés du corps.."
}
}
}
45 changes: 45 additions & 0 deletions locales/nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"addcom": {
"addkeys": "Voegt sleutels aan een auto toe voor iemand.",
"addkeys_id": "id",
"addkeys_id_help": "Speler ID",
"addkeys_plate": "plate",
"addkeys_plate_help": "Kenteken",
"givekeys": "Geef sleutels aan iemand. Als er geen ID wordt gegeven, worden de sleutels aan iemand dichtbij of iedereen in de auto gegeven.",
"givekeys_id": "id",
"givekeys_id_help": "Speler ID",
"givekeys_plate": "plate",
"givekeys_plate_help": "Kenteken",
"remove_keys": "Verwijder sleutels naar een auto voor iemand.",
"remove_keys_id": "id",
"remove_keys_id_help": "Speler ID",
"remove_keys_plate": "plate",
"remove_keys_plate_help": "Kenteken"
},
"info": {
"engine": "Zet motor aan/uit",
"search_keys": "~g~[H]~w~ - Zoek Sleutels",
"toggle_locks": "Zet auto op slot of haal hem van het slot af",
"vehicle_theft": "Voertuigdiefstal bezig. Type: "
},
"notify": {
"carjack_failed": "Voertuigdiefstal mislukt!",
"failed_lockedpick": "Je kon de sleutels niet vinden en raakt gefrustreerd.",
"gave_keys": "Je hebt de sleutels overgedragen.",
"added_keys": "Je hebt een kopie van de sleutels voor het voertuig met kenteken %s gegeven aan speler %s!",
"keys_taken": "Je kreeg de sleutels van het voertuig!",
"no_keys": "Je hebt de sleutels van dit voertuig niet.",
"not_near": "Er is niemand in de buurt om sleutels aan te geven",
"vehicle_locked": "Voertuig op slot gezet!",
"vehicle_lockedpick": "Je hebt de deur open gebroken!",
"vehicle_unlocked": "Voertuig van het slot gehaald!",
"removed_keys": "De sleutels voor het voertuig met kenteken %s voor speler %s zijn afgenomen!",
"removed_keys_player": "De sleutels voor het voertuig met kenteken %s zijn van je afgenomen!",
"player_offline": "Deze speler is niet online!"
},
"progress": {
"attempting_carjack": "Voertuig Stelen...",
"searching_keys": "Sleutels Zoeken...",
"takekeys": "Sleutels van lichaam af halen..."
}
}
9 changes: 6 additions & 3 deletions locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
"notify": {
"carjack_failed": "Falha no assalto ao veículo!",
"failed_lockedpick": "Falhas em encontrar as chaves e ficas frustrado.",
"fpid": "Preenche os argumentos do ID do jogador e da placa",
"gave_keys": "Entregaste as chaves.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Recebeste as chaves do veículo!",
"no_keys": "Não tens as chaves deste veículo.",
"not_near": "Não há ninguém por perto para entregar as chaves",
"vehicle_locked": "Veículo trancado!",
"vehicle_lockedpick": "Conseguiste abrir a fechadura da porta!",
"vehicle_unlocked": "Veículo destrancado!"
"vehicle_unlocked": "Veículo destrancado!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Tentativa de assalto ao veículo...",
"searching_keys": "Procurando pelas chaves do carro...",
"takekeys": "Tirando as chaves do corpo..."
}
}
}
7 changes: 5 additions & 2 deletions locales/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@
"notify": {
"carjack_failed": "Furtul de mașină a eșuat",
"failed_lockedpick": "Nu ai putut clona cheile masinii si te stresezi.",
"fpid": "Trebuie sa introduci ID-ul jucatorului si numarul de inmatriculare",
"gave_keys": "Ai dat cheile vehiculului.",
"added_keys": "You gave a copy of the keys to vehicle %s to player %s!",
"keys_taken": "Ai primit cheile vehiculului!",
"no_keys": "Nu ai cheile acestui vehicul.",
"not_near": "Nu este nimeni langa tine sa-i dai cheile vehiculului",
"vehicle_locked": "Vehicul blocat - Alarma activa!",
"vehicle_lockedpick": "Felicitari, ai reusit sa spargi incuietoarea!",
"vehicle_unlocked": "Vehicul deblocat - Alarma inactiva!"
"vehicle_unlocked": "Vehicul deblocat - Alarma inactiva!",
"removed_keys": "The keys to plate %s for player %s have been removed!",
"removed_keys_player": "Your keys to plate %s have been removed!",
"player_offline": "This player is not online!"
},
"progress": {
"attempting_carjack": "Incerci sa fur vehiculul...",
Expand Down
40 changes: 21 additions & 19 deletions server/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ lib.addCommand('givekeys', {
},
restricted = false,
}, function (source, args)
TriggerClientEvent('qb-vehiclekeys:client:GiveKeys', source, args[locale('addcom.givekeys_id')], args[locale('addcom.givekeys_plate')])
local id = args[locale('addcom.givekeys_id')]
if id and not exports.qbx_core:GetPlayer(id) then
exports.qbx_core:Notify(source, locale('notify.player_offline'))
return
end

TriggerClientEvent('qb-vehiclekeys:client:GiveKeys', source, id, args[locale('addcom.givekeys_plate')])
end)

lib.addCommand('addkeys', {
Expand All @@ -25,26 +31,24 @@ lib.addCommand('addkeys', {
{
name = locale('addcom.addkeys_id'),
type = 'playerId',
help = locale('addcom.addkeys_id_help'),
optional = true
help = locale('addcom.addkeys_id_help')
},
{
name = locale('addcom.addkeys_plate'),
type = 'string',
help = locale('addcom.addkeys_plate_help'),
optional = true
help = locale('addcom.addkeys_plate_help')
},
},
restricted = 'group.admin',
}, function (source, args)
local id = args[locale('addcom.addkeys_id')]
local plate = args[locale('addcom.addkeys_plate')]
if not id or not plate then
exports.qbx_core:Notify(source, locale('notify.fpid'))
return
local success = GiveKeys(id, plate)
if success then
exports.qbx_core:Notify(source, locale('notify.added_keys', plate, id))
else
exports.qbx_core:Notify(source, locale('notify.player_offline'))
end

GiveKeys(id, plate)
end)

lib.addCommand('removekeys', {
Expand All @@ -53,24 +57,22 @@ lib.addCommand('removekeys', {
{
name = locale('addcom.removekeys_id'),
type = 'playerId',
help = locale('addcom.remove_keys_id_help'),
optional = true
help = locale('addcom.remove_keys_id_help')
},
{
name = locale('addcom.removekeys_plate'),
type = 'string',
help = locale('addcom.remove_keys_plate_help'),
optional = true
help = locale('addcom.remove_keys_plate_help')
}
},
restricted = 'group.admin',
}, function (source, args)
local id = args[locale('addcom.removekeys_id')]
local plate = args[locale('addcom.removekeys_plate')]
if not id or not plate then
exports.qbx_core:Notify(source, locale('notify.fpid'))
return
local success = RemoveKeys(id, plate)
if success then
exports.qbx_core:Notify(source, locale('notify.removed_keys', plate, id))
else
exports.qbx_core:Notify(source, locale('notify.player_offline'))
end

RemoveKeys(id, plate)
end)
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function GiveKeys(id, plate)
if not vehicleList[plate] then vehicleList[plate] = {} end
vehicleList[plate][player.PlayerData.citizenid] = true

exports.qbx_core:Notify(id, locale('notify.keys_taken'))
TriggerClientEvent('qb-vehiclekeys:client:AddKeys', id, plate)
exports.qbx_core:Notify(id, locale('notify.keys_taken'))

return true
end
Expand Down

0 comments on commit 065a5f1

Please sign in to comment.