Quantcast

Jump to content

» «
Photo

[IV] Get Ped ID ?

7 replies to this topic
stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#1

Posted 31 January 2014 - 02:20 PM

i want to know if it is possible to get the ped id of the ped which I just spawned.

 

Because Ii want to make it so that you can switch from body to body but still see the old ped,

 

So if I spawn a ped, then if I press (for example) P then I need to take control over that ped, but still need to see Niko,

Is this possible ? 


InfamousSabre
  • InfamousSabre

    Harpocrates

  • Members
  • Joined: 03 Jan 2013

#2

Posted 31 January 2014 - 11:18 PM

When you spawn it, save the returned id

GTA.Ped myped = World.CreatePed(<your parameters here>);


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#3

Posted 01 February 2014 - 02:32 PM

so then the myped is the return ID ? and i could use it in this native function .. ?

 

Function.call("SET_PLAYER_CONTROL", myped, 1);

 

and then i can control the ped ?


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#4

Posted 04 February 2014 - 01:59 PM

so then the myped is the return ID ? and i could use it in this native function .. ?

 

Function.call("SET_PLAYER_CONTROL", myped, 1);

 

and then i can control the ped ?

If i try this, I get this error :

 

Attempted to read or write protected memory..

 

Help! Anyone!?


julionib
  • julionib

    Coder

  • Feroci
  • Joined: 13 Sep 2012
  • Brazil

#5

Posted 05 February 2014 - 01:23 AM Edited by julionib, 05 February 2014 - 01:24 AM.

the set_player_control method just sets if the indicated Player (first param) can control or not the character (second param), so, it dont will work for Peds, this si how you use this method:

Function.call("SET_PLAYER_CONTROL", player, 0)

or, to enable control:

Function.call("SET_PLAYER_CONTROL", player, 1)

im not sure if you can directly control a ped in game like you control player character


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#6

Posted 05 February 2014 - 01:34 PM

the set_player_control method just sets if the indicated Player (first param) can control or not the character (second param), so, it dont will work for Peds, this si how you use this method:

Function.call("SET_PLAYER_CONTROL", player, 0)

or, to enable control:

Function.call("SET_PLAYER_CONTROL", player, 1)

im not sure if you can directly control a ped in game like you control player character

 

Ok, so it seems i can't do that, then the following thing, i think this is the best idea to do it then,

you mustn't see the ped spawn, so it has to replace niko in 0.5 seconds or i don't know, but is this even possible ? because when i try this, the ped just comes falling out of the air.. 


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#7

Posted 05 February 2014 - 03:14 PM

if u dont want them to fall from the air u call .ToGround() on the position. It is a vector3 method.


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#8

Posted 08 February 2014 - 10:05 AM

i tried this, but he's still falling from the air...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users