Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

      1. Events
    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
nikita488

SET_PED_HEAD_OVERLAY works on C++, but don't works on C#

Recommended Posts

nikita488

This code set makeup and lipstick:
This code works:


DWORD model = GAMEPLAY::GET_HASH_KEY("mp_f_freemode_01");if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)){	STREAMING::REQUEST_MODEL(model);					while (!STREAMING::HAS_MODEL_LOADED(model))	WAIT(0); 	PLAYER::SET_PLAYER_MODEL(PLAYER::PLAYER_ID(), model);        //Head        PED::SET_PED_HEAD_BLEND_DATA(PLAYER::PLAYER_PED_ID(), 21, 12, 0, 21, 12, 0, 0, 0, 0, 0);        //Makeup        PED::SET_PED_HEAD_OVERLAY(PLAYER::PLAYER_PED_ID(), 4, 0, 1);        //Lipstick        PED::SET_PED_HEAD_OVERLAY(PLAYER::PLAYER_PED_ID(), 8, 1, 1);	STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);		}


This code don't works:

var characterModel = new Model(PedHash.FreemodeFemale01);characterModel.Request(500);if (characterModel.IsInCdImage && characterModel.IsValid){    if (characterModel.IsInCdImage && characterModel.IsValid)    {                while (!characterModel.IsLoaded) Script.Wait(100);                Function.Call(Hash.SET_PLAYER_MODEL, Game.Player, characterModel.Hash);                //Head                Function.Call(Hash.SET_PED_HEAD_BLEND_DATA, Game.Player.Character.Handle, 21, 12, 0, 21, 12, 0, 0, 0, 0, 0);                //Makeup                Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 4, 0, 1);                //Lipstick                Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 8, 1, 1);     }            characterModel.MarkAsNoLongerNeeded();}

On C++ it's set makeup and lipstick, but on C# its don't work :C

Edited by nikita488

Share this post


Link to post
Share on other sites
leftas

I guess this is one of cases where you have to loop to have an effect, I haven't looked why in .net wrapper you need to loop these things, but my guess is because of single GTA Thread.

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
nikita488

Loop? Like this?

 

while (true){    //Makeup    Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 4, 0, 1);    //Lipstick    Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 8, 1, 1);}

Share this post


Link to post
Share on other sites
leftas

Yes, you can do this. But this will run as long as your script will be running. So I suggest to you that you would make a global bool and use that instead of always true.

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
nikita488

So, while (true) freeze my game :p

Edited by nikita488

Share this post


Link to post
Share on other sites
leftas

Oh right, I forgot about that, you need to Wait(0); at the end of the loop. Because GTA scripts runs in coop-multitask, so while your script are running others are waiting for something(for example for model to load)

 

All the best,

Paul

Share this post


Link to post
Share on other sites
nikita488
while (true){//MakeupFunction.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 4, 0, 1);//LipstickFunction.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 8, 1, 1);Script.Wait(0);} 

So, now my game don't freeze, but it doesn't work :C

Share this post


Link to post
Share on other sites
leftas

Are you putting this in tick method ? And if yes what's interval ?

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
nikita488

So, i fix this. Problem in last parameter:

 

Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 4, 0, 1);Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 8, 1, 1);
Last parameter is a opacity, if i set it to 1, in game its set to 1.401298E-45, but if i set it to 1.0, in game its set to 1.

Fix code:

 

Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 4, 0, 1.0);Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.Player.Character.Handle, 8, 1, 1.0);
Thanks Paul, you are very good guy :) Edited by nikita488
  • Like 1

Share this post


Link to post
Share on other sites
leftas

Ah, I never tried this method, so I didn't know the parameters also I haven't looked as I think you knew them, lol :D

Anyway, thanks! And yes floats and integer different and are not very compatible.

 

All the best,

Paul.

Edited by leftas

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.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.