Jump to content
  • Advertisement

Pedro Alves

Member
  • Content count

    164
  • Joined

  • Last visited

Community Reputation

251 Neutral

1 Follower

About Pedro Alves

  • Rank
    Member

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. i can´t make work my get two or more methods in same route i have the code 404 i using mysql nodejs and express my code controller alliances what i doing wrong my code const User = require('../models/Alliances') const findAlianca = async (connection, req, res) => { const Allianca = await User.find(connection, req.session.user.username) if (!Allianca) { res.status(404).send('Nenhuma cidade encontrada.'); return; } console.log("dddd"); req.session.Allianca = Allianca res.locals.Allianca = Allianca res.render('Administration/Alliances') } module.exports = { findAlianca } route aliance const express = require('express') const router = express.Router() const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const controlleruser = require('../../controllers/Alliances') router.get('/Administration/Alliances', (req, res) => controllerAdmin.findcidade3(connection, req, res)) router.get('/Administration/Alliances/limitado', (req, res) => controlleruser.findAlianca(connection, req, res)) module.exports = app => app.use('/', router) models aliance const find = (connection,username) => { return new Promise((resolve, reject) => { connection.query(SELECT alianca.nome,alianca.N_membros,alianca.TAG FROM user INNER JOIN alianca ON user.cod_alianca=alianca.id WHERE user.username='${username}', (err, result) => { if(err){ reject(err) }else{ resolve(result) } }) }) } module.exports = { find } alliance.jade extends layout block title .col-xs-6.col-xs-offset-3.col-sm-6.col-sm-offset-3 .col-sm-4(style='width:76%') div.panel.panel-primary(style='height:50px') Alliances Page div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl if locals.user.cod_alianca==null p You Dont Have Alliances else br span Your Aliance span= locals.Allianca.nome .col-xs-2.panel-red(style='width:24%;height:100%;text-align:center') my app require('./routes/Administration/Alliances')(app) my connection db const mysql = require('mysql') const config = require( "./config.json" ) const connection =mysql.createConnection({ host:config.host, user:config.user, password:config.password, database:config.database, // port:config.port }); connection.connect((err) =>{ if(err){ console.log(err) process.exit(0) }else{ console.log('database on') } })
  2. i have a problem i can make work the verificay if user existe our not i using nodejs ,express,mysql i put my link to project in github the code its to big https://github.com/Kammikazy/project find the soluction to my problem
  3. Pedro Alves

    Question about add mesh to level

    topic can be close problem as been solve
  4. Pedro Alves

    problem send multiples values in nodejs

    i find the soluction to my problem show all data administration inde route const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration/', (req, res) => res.render('Administration/index')) router.get('/Administration/',controllerAdmin.findcidade.bind(null, connection)) //router.get('/Administration', (req, res) => res.render('Administration/index',controllerAdmin.findcidade.bind(null, connection))) //*/ module.exports = app => app.use('/', router) Administration controller const Cidade = require('../models/Cidades') const findcidade = async (connection, req, res) => { const cidade = await Cidade.findcidade(connection, req.session.user.username) if(!cidade){ return false } else{ // console.log(cu); // user.password = undefined req.session.cidade = cidade res.locals.cidade = cidade res.render('Administration/') } } extends layout block content b Player: b= locals.user.username block title .col-xs-10.col-xs-offset-2.col-sm-8.col-sm-offset-2 br div.panel.panel-primary(style='height:50px',width='30px') img(width='50px', height='50px', src='../images/recursos/ouro.png') | 10 img(width='50px', height='50px', src='../images/recursos/madeira.png') | 10 img(width='50px', height='50px', src='../images/recursos/metal.png') | 10 img(width='50px', height='50px', src='../images/recursos/pedra.png') | 10 img(width='50px', height='50px', src='../images/recursos/Lampada.png') | 10 img(width='50px', height='50px', src='../images/recursos/comida.png') | 10 img(width='50px', height='50px', src='../images/recursos/petrolio.png') | 10 img(width='50px', height='50px', src='../images/recursos/moeda.png') | 10 .col-sm-4(style='width:85%') div.panel.panel-primary(style='height:50px') dsadsadasdsad div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl .col-sm-4.panel.panel-red(style='width:15%;height:100%') | [1/1] City br - each val in cidade b= val.Nome br b= val.coordenadas b= val.continente br topic can be close
  5. Hello i try retrive data from a table cidades and show in my express with jade const express = require('express') const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const router = express.Router() //router.get('/Administration', controllerLogin.FindCidades) router.get('/Administration', (req, res) => res.render('Administration/index',{username:res.locals.user.username ,nome:res.locals.cidade.Nome,coordenas:res.locals.cidade.coordenadas,continente:res.locals.cidade.continente })) module.exports = app => app.use('/', router) const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined req.session.user = user //const nivel = await User.findnivel(connection, req.body.username) if(user.nivel==1){ const cu = await Cidade.findcidade(connection, req.body.username) // req.session.user.nivel = nivel res.locals.user= user req.session.cidade= cu res.locals.cidade= req.session.cidade // console.log(1); console.log("rewr",cu); res.redirect('/Administration'); }else if(user.nivel==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.nivel==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.nivel==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } } } const findcidade = (connection,username) => { return new Promise ((resolve, reject) => { connection.query(`SELECT cidade.cod_cidade, cidade.Nome,cidade.continente,cidade.coordenadas,cidade.ouro,cidade.madeira,cidade.metal,cidade.pedra,cidade.energia, cidade.comida,cidade.petrolio FROM user INNER JOIN cidade ON user.cod_user=cidade.cod_user WHERE user.username='${username}' `, (err, result) =>{ if(err){ reject(err) }else{ if(result.length>0){ resolve(result) } else{ resolve(false) } } }) }) } give this error what i doing wrong i want show for example user maria have athenas and rome
  6. Pedro Alves

    nodejs problem

    i finaly find the soluction the soluction to my problem const authenticateUser = async (connection, req, res) => { const user = await User.findUser(connection, req.body.username) if(!user){ return res.render('login/login',{error: true}) } if(!await bcrypt.compare(req.body.password, user.password)){ return res.render('login/login', {error: true}) } else{ // user.password = undefined //const nivel = await User.findnivel(connection, req.body.username) if(user.user_type_id==1){ req.session.user = user res.locals.user = user res.redirect('/Administration'); }else if(user.user_type_id==2){ // req.session.nivel = nivel console.log(2); // res.redirect('/Users') }else if(user.nivel==3){ // req.session.nivel = nivel console.log(3); // res.redirect('/Administration') }else if(user.user_type_id==4){ // req.session.nivel = nivel console.log(4); // res.redirect('/Administration') } else if(user.user_type_id==5){ // req.session.nivel = nivel console.log(5); // res.redirect('/Administration') } else { console.log("banned"); } topic can be close
  7. Pedro Alves

    nodejs problem

    i try make a login system with mysql when run de nodejs and open the firefox page is not redirecting correctly Firefox has detected that the server is redirecting the request to this address in a way that will never be completed. This problem can sometimes be caused by disabling or declining to accept cookies.
  8. I can not get my tabs to change the text When I load for example in general he should change to the text of the general but I can not by I'm using nodejs with express news.jade extends layout block content h1 Last News section#page-title h1.mainTitle br .tabbable ul#myTab2.nav.nav-tabs.nav-justified li.active a(href='#All', data-toggle='tab') | All li a(href='#Geral', data-toggle='tab') | General li a(href='#Events', data-toggle='tab') | Events li a(href='#Updates', data-toggle='tab') | Updates li a(href='#Sales', data-toggle='tab') | Sales li a(href='#Community', data-toggle='tab') | Community .tab-content #All.tab-pane.fade.in.active p | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Geral.tab-pane.fade p | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo. p | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. #Events.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Updates.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Sales.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. #Community.tab-pane.fade p | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. p | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.  news.js var express = require('express'); var router = express.Router(); /* GET users listing. */ router.get('/', function(req, res, next) { res.render('news', { title: ' Last news' }); $(document).ready(function(){ $(".nav-tabs a").click(function(){ $(this).tab('show'); }); }); });  module.exports = router; what i doing wrong i don´t have any error
  9. Pedro Alves

    Question about add mesh to level

    this how i fix my problem
  10. Pedro Alves

    Question about add mesh to level

    finaly find the problem
  11. Pedro Alves

    Question about add mesh to level

    ok sorry my english is very bad yes i have to spawn a actor from the class i don´t know how to spawn a character bp class to the level
  12. my question is the following I am creating a system to create characters and my doubt is to add to the level a new character that is character type bp I have to use the spawn for example the player chooses a tree puts the name click create in the slot and put the name and in the level it is attached to a tree
  13. Pedro Alves

    newbie question about dedicate server

    problem as been solve i copy all data from the old project to new one its is dedicate server
  14. Pedro Alves

    widget don´t generate slots

    problem has been solve
  15. my creating a dedicate server to my game i start my project not using unreal engine source my question i have start a new project with new engine source compiled our i only to have to create a connection between the cliente and server
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!