Jump to content

[SOLVED] It is impossible to change clothes CJ in RACE


Recommended Posts

Hello! :) At me a problem. I want in standard to mode RACE, to dress CJ how it is necessary for me.

I used this function: AddPedClothes

I have made it. And the cap changes only (addPedClothes ( source, "helmet", "helmet", 16 )). :(

2314688m.png

Here lua code:

function onEnterVehicle ( theVehicle, seat, jacked ) 
   addPedClothes ( source, "helmet", "helmet", 16 ) 
   addPedClothes ( source, "glasses03blue", "glasses03", 15 ) 
   addPedClothes ( source, "tshirtwhite", "tshirt", 0 ) 
   addPedClothes ( source, "sneakerproblu", "sneaker", 3 ) 
   addPedClothes ( source, "bbshortwht", "boxingshort", 2 ) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 

Where my mistake?

// Resolved by -ffs-Sniper

function onEnterVehicle ( theVehicle, seat, jacked ) 
   for i = 1, 17 do 
       removePedClothes ( source, i ) 
   end 
   addPedClothes ( source, "helmet", "helmet", 16 ) 
   addPedClothes ( source, "glasses03blue", "glasses03", 15 ) 
   addPedClothes ( source, "tshirtwhite", "tshirt", 0 ) 
   addPedClothes ( source, "sneakerproblu", "sneaker", 3 ) 
   addPedClothes ( source, "bbshortwht", "boxingshort", 2 ) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 

Edited by Guest
Link to comment
Race might already have a handler onPlayerVehicleEnter. Therefore set the handler's priority to "low". This way you can ensure your code will be executed as last.

Be sure you are using the latest nightly of MTA! ->https://nightly.multitheftauto.com/

addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle, "low" ) 

Don't work. :( Im always used latest nightly builds MTA. :roll:

Link to comment

Try to debug it.

Because it's race it's not working on it I think

just typ /debugscript 3

function onEnterVehicle ( theVehicle, seat, jacked ) 
   addPedClothes ( source, "helmet", "helmet", 16 ) 
   addPedClothes ( source, "glasses03blue", "glasses03", 15 ) 
   addPedClothes ( source, "tshirtwhite", "tshirt", 0 ) 
   addPedClothes ( source, "sneakerproblu", "sneaker", 3 ) 
   addPedClothes ( source, "bbshortwht", "boxingshort", 2 ) 
outputChatBox ( "function pl0x 0.o" ) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 

Link to comment

I think I found the mistake: You need to remove old clothes before adding new ones of a different type.

function onEnterVehicle ( theVehicle, seat, jacked ) 
   for i = 1, 17 do 
       removePedClothes ( source, i ) 
   end 
   addPedClothes ( source, "helmet", "helmet", 16 ) 
   addPedClothes ( source, "glasses03blue", "glasses03", 15 ) 
   addPedClothes ( source, "tshirtwhite", "tshirt", 0 ) 
   addPedClothes ( source, "sneakerproblu", "sneaker", 3 ) 
   addPedClothes ( source, "bbshortwht", "boxingshort", 2 ) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle, "low" ) 

Link to comment
I think I found the mistake: You need to remove old clothes before adding new ones of a different type.
function onEnterVehicle ( theVehicle, seat, jacked ) 
   for i = 1, 17 do 
       removePedClothes ( source, i ) 
   end 
   addPedClothes ( source, "helmet", "helmet", 16 ) 
   addPedClothes ( source, "glasses03blue", "glasses03", 15 ) 
   addPedClothes ( source, "tshirtwhite", "tshirt", 0 ) 
   addPedClothes ( source, "sneakerproblu", "sneaker", 3 ) 
   addPedClothes ( source, "bbshortwht", "boxingshort", 2 ) 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onEnterVehicle ) 

Woohoo! It's work! :roll::D But without 'low'. With 'low' - don't work. Thank you very much. 8)

Link to comment

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