gravgor2137

setVariable dosen't work

Recommended Posts

mp.events.add("getInformationAboutDuty", (player) => {
        gm.mysql.handle.query('SELECT `login`,`ranga`, `adminduty` FROM `rp_administration` WHERE `login` = ?', [player], function(err, res){
            let login = res[0]["login"];
            let ranga = res[0]["ranga"];
            let aduty = res[0]["adminduty"];
            console.log(`Login gracza: ${login}, Ranga gracza: ${ranga}, Level duty: ${aduty}`);
            player.setVariable('duty', aduty);
            player.outputChatBox(`Zostałeś zalogowany na służbę administracyjną`);
            player.setVariable('ranga', ranga);
        });
    });

 

 

 

Hi! In this code something does not work for me setVariable - does anyone know why? No error in the console.
   

Share this post


Link to post
Share on other sites

asdaxacacshffs48e.png
read this.

try this:

mp.events.add("getInformationAboutDuty", (player) => {
	gm.mysql.handle.query('SELECT * FROM rp_administration WHERE login = ?', [player], function(err, res) {
		player.setVariable('login', result[0].login);
		player.setVariable('ranga', result[0].ranga);
		player.setVariable('adminduty', result[0].adminduty);
		console.log(`Login gracza: ${player.getVariable('login')}, Ranga gracza: ${player.getVariable('ranga')}, Level duty: ${player.getVariable('adminduty')}`);
		player.outputChatBox(`Zostałeś zalogowany na służbę administracyjną`);
	});
});

 

Share this post


Link to post
Share on other sites

/clients/s44127/packages/administration-system/mysql.js:75: TypeError: Cannot read property 'query' of null
gm.mysql.handle.query('SELECT * FROM rp_administration WHERE login = ?', [player], function(err, res) {

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.