Jump to content

Example for placing objects like water dispenser or weed


Recommended Posts

Posted

Hey there,

i wanted to fill a interior with weed for a weed processor.

My question is: How to place items? Is there a serverside command like in arma was or has this to be done in map editor itself? 

Second question: How to place an NPC to ineract with a menu? 

Thanks and regards

Posted

Object Creating is no problem but peds aren't created no matter what i trie with above given command. I want them just to stay there static doing nothing.

Posted
let Ped = mp.peds.new(mp.game.joaat('MP_F_Freemode_01'), new mp.Vector3( 100.0, -100.0, 25.0), 270.0, (streamPed) => {
    // Ped Streamed
    streamPed.setAlpha(0);
  	streamPed.freezePosition(true);
}, player.dimension);

 

  • Like 1
  • Mask 1
Posted

Thanks for the example Captien. I tried without the freeze Position but the Ped never showed up. Will try this one

Posted

Thanks again Fanta. I guessed the Alpha was the problem. I also tried without the setAlpha command but still not worked. Does setAlpha(0) mean it is there but invisible then? 

Posted (edited)

Okay what i was trying is to create a ped on players position which did not work like doing so (i don't know why it is not working because it returns coords)

const localPlayer = mp.players.local;

let Ped = mp.peds.new(mp.game.joaat('ig_abigail'), new mp.Vector3(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z), 270.0, (streamPed) => {
    // Ped Streamed
    streamPed.setAlpha(255);
      streamPed.freezePosition(true);
    }, 0);

but using coords its working now:

let Ped = mp.peds.new(mp.game.joaat('ig_abigail'), new mp.Vector3(429.6809387207031, -975.9828491210938, 30.710344314575195), 270.0, (streamPed) => {
    // Ped Streamed
    streamPed.setAlpha(255);
      streamPed.freezePosition(true);
    }, 0);

Funfact: If you shoot the ped, the game crashes

Edited by cmdflow
  • Confused 1

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...