Skip to content

Instantly share code, notes, and snippets.

@almcarvalho
Created August 18, 2022 03:58
Show Gist options
  • Select an option

  • Save almcarvalho/e17f73773e49bf3e2c0cb204e1937ae7 to your computer and use it in GitHub Desktop.

Select an option

Save almcarvalho/e17f73773e49bf3e2c0cb204e1937ae7 to your computer and use it in GitHub Desktop.
RegisterCommand('item',function(source,args,rawCommand)
local user_id = vRP.getUserId(source)
local identity = vRP.getUserIdentity(user_id)
if args[1] == "dinheiro" then
print("spawn de dinehiro ")
if user_id ~= 1 then
print("tentativa de spawnar dinheiro bloqueada ")
PerformHttpRequest(config.Item, function(err, text, headers) end, 'POST', json.encode({
embeds = {
{ ------------------------------------------------------------
title = "TENTATIVA DE GERAR DINHEIRO NEGADA!!:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀",
thumbnail = {
url = config.webhookIcon
},
fields = {
{
name = "**COLABORADOR DA EQUIPE:**",
value = "[**"..user_id.."**]"
},
{
name = "**ITEM NEGADO**",
value = "[Dinheiro]"
}
},
footer = {
text = config.webhookBottomText..os.date("%d/%m/%Y |: %H:%M:%S"),
icon_url = config.webhookIcon
},
color = config.webhookColor
}
}
}), { ['Content-Type'] = 'application/json' })
return
end
end
if vRP.hasPermission(user_id,"administrador.permissao") or vRP.hasPermission(user_id,"manager.permissao") then
if args[1] and args[2] then
local itemIndex = vRP.itemIndexList(args[1])
if itemIndex then
local itemName = vRP.itemNameList(args[1])
vRP.giveInventoryItem(user_id,args[1],parseInt(args[2]))
PerformHttpRequest(config.Item, function(err, text, headers) end, 'POST', json.encode({
embeds = {
{ ------------------------------------------------------------
title = "REGISTRO DE ITEM GERADO:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀",
thumbnail = {
url = config.webhookIcon
},
fields = {
{
name = "**COLABORADOR DA EQUIPE:**",
value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]"
},
{
name = "**ITEM GERADO**",
value = "[ **Item: "..itemName.."** ][ **Quantidade: "..tonumber(args[2]).."** ]\n⠀⠀"
}
},
footer = {
text = config.webhookBottomText..os.date("%d/%m/%Y |: %H:%M:%S"),
icon_url = config.webhookIcon
},
color = config.webhookColor
}
}
}), { ['Content-Type'] = 'application/json' })
TriggerClientEvent("itensNotify",source,"usar","Pegou",""..itemIndex.."")
else
TriggerClientEvent("Notify",source,"negado","Item <b>inválido ou inexistente</b>.")
end
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment