Jump to content

I need Help.


fiame1337

Recommended Posts

Hello. I have just started scripting RageMP and I have got this Error.

spacer.png

Here is the Code.

let cef = mp.browser.new("package://assets/registerLogin.html");
mp.gui.cursor.visible = true;

let sceneryCamera = mp.camera.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);

sceneryCamera.pointAtCord(402.8664, -996.4108, -98.5);
sceneryCamera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, flase);

mp.game.ui.displayRadar(false);

mp.events.add("registerLogin.client",function(name,password,type){
    if(name.lenght >= 3 && password.lenght >= 5){
        mp.events.callRemote("registerLogin.server",name,password,type);
    }
    else
    {
        mp.game.graphics.notify("Podatci nisu ispravni");
    }
})

mp.events.add("registerLogin.destroy",function(){
    cef.destroy();
    mp.gui.cursor.visible = false;
    mp.gameui.displayRadar(true);
    mp.game.cam.renderScriptCams(false,false,0,true,false);
})

if(mp.game.ui.isPauseMenuActive()){
    mp.game.ui.setFrontendActive(false);
}

I hope You guys do have more experience than me so You can help me.

Thanks.

Link to comment
Share on other sites

Thanks, I fixed it but I got a new error.

spacer.png

Code is the same.

9 hours ago, MrPancakers said:

mp.browser.new should be mp.browsers.new

let cef = mp.browsers.new("package://assets/registerLogin.html");
mp.gui.cursor.visible = true;

let sceneryCamera = mp.camera.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);

sceneryCamera.pointAtCord(402.8664, -996.4108, -98.5);
sceneryCamera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, flase);

mp.game.ui.displayRadar(false);

mp.events.add("registerLogin.client",function(name,password,type){
    if(name.lenght >= 3 && password.lenght >= 5){
        mp.events.callRemote("registerLogin.server",name,password,type);
    }
    else
    {
        mp.game.graphics.notify("Podatci nisu ispravni");
    }
})

mp.events.add("registerLogin.destroy",function(){
    cef.destroy();
    mp.gui.cursor.visible = false;
    mp.gameui.displayRadar(true);
    mp.game.cam.renderScriptCams(false,false,0,true,false);
})

if(mp.game.ui.isPauseMenuActive()){
    mp.game.ui.setFrontendActive(false);
}

 

Link to comment
Share on other sites

again.....

mp.camera.new should be mp.cameras.new, your error message explains what's wrong in your code. You need to learn how to read the messages being given to you because they tell you exactly what is wrong and this is such a basic error.

Quote

 

client.js:5: TypeError: Cannot read property 'new' of undefined

let sceneryCamera = mp.camera.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);

 

client.js:5 - This says it's inside a file named client.js, and the number means what line the error is on, so inside your client.js file on line 5 is where the error is.

 

Cannot read property 'new' of undefined - This means it cannot read a property called 'new' because whatever is before it is undefined, in this case mp.camera is undefined because it does not exist.

 

So from this error message it tells you the file the error is in, what line it is on, and what the issue is, you need to be able to understand these errors if you want to get better as a developer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...