linglingthething

How to load correct Interior and Request the IPL?

Recommended Posts

Hello i run into a problem on my server.
I just have created a marker and a colshape.
When i stand in the colShape and i type the command /presi -141.1987, -620.913, 168.8205, ex_dt1_02_office_02b

he ports me to a place where i fall through the ground.

my Clientside looks like this:

mp.events.add("loadPresi", (x,y,z,IPLName) => {
  var interior = mp.game.interior.getInteriorAtCoords(x, y, z);
  mp.game.interior.enableInteriorProp(interior, IPLName);
  mp.game.streaming.requestIpl(IPLName);
  mp.game.interior.refreshInterior(interior);
});


my Serverside looks like this:

mp.events.addCommand("presi", (player, fullText, x, y, z, ipl)
    if(PresiColShape.isPointWithin(player.position)) {
		player.outputChatBox("Du hast das Haus des Bürgermeisters betreten");
        player.position = new mp.Vector3(x,y,z);
        player.call('loadInterior', [x,y,z, ipl]);
        console.log('x: ' + x + ' y: ' + y + ' z: ' + z + ' ipl: ' + ipl);
    }
    else
    {
        player.notify("Du stehst nicht vor der Tür des Bürgermeisters!");
    }
});

function playerEnterColshapeHandler(player, shape) {
  if(shape == PresiColShape) {
    player.notify("Du stehst vor der Tür des Bürgermeisters! Gebe /presi ein um das Haus zu betreten!");
  }
}

mp.events.add("playerEnterColshape", playerEnterColshapeHandler);

function playerExitColshapeHandler(player, shape) {
  if(shape == PresiColShape) {
    player.notify("Du hast den Eingangsbereich wieder verlassen!");
  }
}

mp.events.add("playerExitColshape", playerExitColshapeHandler);
Edited by linglingthething

Share this post


Link to post
Share on other sites

I got it working now. i will Post it for you Guys to unterstand it.

 

Serverside:

//Shapes
let PresiColShape = mp.colshapes.newSphere(-544.73876953125, -204.69960021972656, 38.215152740478516, 1, 0);


//Marker
const presimarker = mp.markers.new(2, new mp.Vector3(-544.73876953125, -204.69960021972656, 38.215152740478516),1,
{
    color: [255, 165, 0, 50],
    visible: true,
    dimension: 0
});

//PRESI COMMAND
mp.events.addCommand("presi", (player, fullText, x, y, z) => {
    if(PresiColShape.isPointWithin(player.position)) {
		player.position = new mp.Vector3(-141.78150939941406, -617.6240844726562, 168.82052612304688);
        player.call("loadPresiEingang", [x,y,z]);
		player.notify("Sie haben das Haus des Bürgermeisters betreten!");
    }
});

//BETRITT COLSHAPE
function playerEnterColshapeHandlerEingang(player, shape) {
  if(shape == PresiColShape) {
    player.notify("Du stehst vor der Tür des Bürgermeisters! Gebe /presi ein um das Haus zu betreten!");
  }
}

mp.events.add("playerEnterColshape", playerEnterColshapeHandlerEingang);

clientside:

//presi haus eingang
mp.events.add("loadPresiEingang", (x,y,z,IPLName) => {
  var interior = mp.game.interior.getInteriorAtCoords(-786.8195, 315.5634, 187.9137); //pkt wo der spieler im interior spawnt
  mp.game.streaming.requestIpl("apa_v_mp_h_02_c"); // interior name(IPL)
  mp.game.interior.refreshInterior(interior); // Lädt das Interior neu
});

 

This will work.

Edited by linglingthething
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

Hi, try this.

CLIENTSIDE

function loadInt(x,y,z, ipl) { 
	var interior = mp.game.interior.getInteriorAtCoords(x,y,z); //pkt wo der spieler im interior spawnt
	mp.game.streaming.requestIpl('"'+ipl+'"'); // interior name(IPL)
	mp.game.interior.refreshInterior(interior);
}
mp.events.add('cInterior:loadInt', loadInt);

SERVERSIDE

mp.events.addCommand('testint', (player, allText, x, y, z, iplNAME) => {

	let position = new mp.Vector3(parseFloat(x), parseFloat(y), parseFloat(z));
		player.position = position;
		player.call("cInterior:loadInt",[position.x, position.y, position.z, iplNAME]);

});

Good luck !

Edited by stalinalexandru

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.