TriggerEvent("es:addGroup", "admin", "user", function(group) end)

--Help Commands
TriggerEvent('es:addCommand', 'help', function(source, args, user)
  TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Bienvenue ! Commandes du joueur ")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Pour Changer De Skin /loadout skin")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Pour Gagner de l'argent le job de livreur est le seul disponible pour le moment icone fourgon ")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "touche M menu vehicule /spawn Scorcher ,vehicule gratuit: faggio,Dilettante,Voodoo ")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Utiliser /report pour les plainte et le Non-Rp")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Utiliser /payer id et la somme")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Utiliser /simpleemotes Pour des Animations ")
end)

TriggerEvent('es:addCommand', 'group', function(source, args, user)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Group: ^2" .. user.group.group)
end)

-- Kicking
TriggerEvent('es:addGroupCommand', 'kick', "admin", function(source, args, user)
		if(GetPlayerName(tonumber(args[2])))then
			local player = tonumber(args[2])

			-- User permission check
			TriggerEvent("es:getPlayerFromId", player, function(target)
				if(tonumber(target.permission_level) > tonumber(user.permission_level))then
					TriggerClientEvent("chatMessage", source, "SYSTEM", {255, 0, 0}, "Vous n'etes pas autorise à cibler cette personne!")
					return
				end

				local reason = args
				table.remove(reason, 1)
				table.remove(reason, 1)
				if(#reason == 0)then
					reason = "Kicked: You have been kicked from the server"
				else
					reason = "Kicked: " .. table.concat(reason, " ")
				end

				TriggerClientEvent('chatMessage', -1, "SYSTEM", {255, 0, 0}, "Player ^2" .. GetPlayerName(player) .. "^0 has been kicked(^2" .. reason .. "^0)")
				DropPlayer(player, reason)
			end)
		else
			TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect player ID!")
		end
end, function(source, args, user)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")
end)


TriggerEvent('es:addCommand', 'rmwanted', function(source)
  TriggerEvent("es:getPlayerFromId", source, function(user)
    if(user.money > 100) then
			user:removeMoney((100))
			TriggerClientEvent('es_freeroam:wanted', source)
			TriggerClientEvent("es_freeroam:notify", source, "CHAR_LESTER", 1, "Lester", false, "Les problemes au paradis sont fixes")
		else
			TriggerClientEvent("es_freeroam:notify", source, "CHAR_LESTER", 1, "Lester", false, "Desole mais vous avez besoin de plus d'argent avant de pouvoir vous aider")
		end
	end)
end)
