Jump to content

problem with removePlayerClothes


GioSerpo

Recommended Posts

i am very sure this isn't my script, but, also, its only one article of clothing that is "bugged"

i was playing around with add and removePlayerClothes, and i put ID 16 on (16 = hats) i changed throught a few times, and then wanted to take it off. it wouldnt come off. at the time i thought it was the script, and thought, well no big, but, then, i put a thing to add a helmet on entering an NRG and remove the helmet on exiting it (found it in the wiki)

after getting it adding it and stuff, i found that it wouldnt remove either, so, just to see if it was that script, or a bug, i changed the clothes type from 16 to 0 in the script (0 = shirts)

i the reloaded it and went back in, and sure enough, the shirt came off when i got off of the bike. so, i modifies it again to remove id 16, and still, it didnt remove the helmet... so, my thought its an MTA bug not a script fault, but, i do not know.

i ran a few more tests to see, but, everything i tested came off. the hat, however, stayed in all of the tests.

Link to comment

mmk, here it is, then

WORKING ADDPLAYERCLOTHES:

function addHelmetOnEnter ( player, seat, jacked ) 
  
  if ( getVehicleID ( source ) == 522 ) then -- if its a nrg 
    addPlayerClothes ( player, "helmet", "helmet", 16 ) -- add the helmet 
  end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), addHelmetOnEnter ) 

NOT WORKING REMOVEPLAYERCLOTHES:

function removeHelmetOnExit ( player, seat, jacked ) 
  
    if ( getVehicleID ( source ) == 522 ) then -- if its a nrg 
        removePlayerClothes ( player, 16 ) -- remove that helmet 
    end 
end 
addEventHandler ( "onVehicleExit", getRootElement(), removeHelmetOnExit ) 

WORKING REMOVEPLAYERCLOTHES:

function removeHelmetOnExit ( player, seat, jacked ) 
  
    if ( getVehicleID ( source ) == 522 ) then -- if its a nrg 
        removePlayerClothes ( player, 0 ) -- remove that helmet 
    end 
end 
addEventHandler ( "onVehicleExit", getRootElement(), removeHelmetOnExit ) 

and here is my /removeclothes command

function consoleRemoveClothes ( player, commandName, type ) 
    if ( player ) then 
        if ( getPlayerSkin ( player ) == 0 ) then 
            if ( removePlayerClothes ( player, tonumber ( type ) ) == false ) then 
                outputConsole ( "Failed to remove clothes.", player ) 
            end 
        else 
            outputConsole ( "You must have the CJ model.", player ) 
        end 
    end 
end 
addCommandHandler ( "removeclothes", consoleRemoveClothes ) 

note, the differenc in the working and the non working is the number, working is 0, nonworking is 16, but, 1, 2, 3, 13, 14, and 15 (i didnt test them with the tattoos) worked as well

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...