Improve notify messages and fix premature pickup success notice
Distance rejection now says exactly why, the PIN rate-limit shows remaining seconds, and the client no longer announces pickup success before the server validates it.
This commit is contained in:
parent
a85703ee19
commit
781607a434
@ -109,7 +109,6 @@ RegisterNetEvent('safe:spawn', function(safeData)
|
|||||||
})
|
})
|
||||||
|
|
||||||
if result == 'confirm' then
|
if result == 'confirm' then
|
||||||
lib.notify({ type = 'success', description = 'Safe recolhido com sucesso!' })
|
|
||||||
TriggerServerEvent('safe:pickup', safeData.id)
|
TriggerServerEvent('safe:pickup', safeData.id)
|
||||||
else
|
else
|
||||||
lib.notify({ type = 'inform', description = 'Operação cancelada.' })
|
lib.notify({ type = 'inform', description = 'Operação cancelada.' })
|
||||||
|
|||||||
@ -111,7 +111,7 @@ RegisterNetEvent('safe:place', function(type, coords, pin)
|
|||||||
|
|
||||||
if #(playerCoords - placeCoords) > PLACE_MAX_DISTANCE then
|
if #(playerCoords - placeCoords) > PLACE_MAX_DISTANCE then
|
||||||
dbg('safe:place REJEITADO - distância suspeita', src, #(playerCoords - placeCoords))
|
dbg('safe:place REJEITADO - distância suspeita', src, #(playerCoords - placeCoords))
|
||||||
return TriggerClientEvent('ox_lib:notify', src, {type='error', description='Posição inválida.'})
|
return TriggerClientEvent('ox_lib:notify', src, {type='error', description='Você está muito longe para colocar o safe aqui.'})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remover item
|
-- remover item
|
||||||
@ -196,7 +196,8 @@ RegisterNetEvent('safe:open', function(id, pin)
|
|||||||
local attempt = pinAttempts[src]
|
local attempt = pinAttempts[src]
|
||||||
|
|
||||||
if attempt and now < attempt.blockedUntil then
|
if attempt and now < attempt.blockedUntil then
|
||||||
return TriggerClientEvent('ox_lib:notify', src, {type='error', description='Muitas tentativas erradas. Aguarde.'})
|
local remaining = math.ceil(attempt.blockedUntil - now)
|
||||||
|
return TriggerClientEvent('ox_lib:notify', src, {type='error', description=('Muitas tentativas erradas. Aguarde %d segundos.'):format(remaining)})
|
||||||
end
|
end
|
||||||
|
|
||||||
local safe = safes[id]
|
local safe = safes[id]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user