1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Faction Character Creation Skins/bodygroups [FIXED]

Discussion in 'Programming' started by Tomo742, Jun 22, 2014.

  1. Tomo742

    Tomo742 Guest

    Does anyone know how to instantly set the skin/bodygroups upon character creation?
     
  2. Re: Faction Character Creation Skins/bodygroups

    Something like this, or am I misinterpreting?

    Code:
    function PLUGIN:PlayerCharacterLoaded(player)
    	player:SetBodygroup( bodygroup, value )
    	player:SetSkin( skin )
    end
    
     
  3. Tomo742

    Tomo742 Guest

    Re: Faction Character Creation Skins/bodygroups

    I'll try, however I wanted it to set it upon character creation and not loading a character. I also wanted to save them to that character so it loaded upon creation and loading. Kind of like how the setskin/bodygroup setter works except all uppon character creation so an admin doesn't have to keep setting bodygroups/skins for everyone.

    Edit - The code you gave me doesn't work it seems, I did try it myself but then I tested yours just to make sure. Perhaps another hook I could use instead.
     
  4. Re: Faction Character Creation Skins/bodygroups

    You don't set the bodygroup/skin on character creation, man, the player hasn't even spawned at that point. If you want the bodygroups/skins to persist you could also probably add it to the character data (so that it gets saved to MySQL, though I don't know if any non-standard data gets saved there) and set the bodygroup/skin on load based on that.

    Bodygroups/skins have known to be iffy in GMod multiplayer anyways (see Daemon's TnB pack, it was completely fucked), so it may be that the code's right but the game is being a dick.
     
  5. Tomo742

    Tomo742 Guest

    Re: Faction Character Creation Skins/bodygroups

    Hmm, that's what I want to do then. I want it to set the bodygroups/skins via adding it to the character data, then when the character data is loaded and the character is spawned whatever. It loads the character data and sets the skin/bodygroups.
     
  6. Re: Faction Character Creation Skins/bodygroups

    Oh hey, try using entity:Fire() though.

    Code:
    function PLUGIN:PlayerCharacterLoaded(player)
    	player:Fire( "setbodygroup", params )
    	player:Fire( "skin", params )
    end
    
     
  7. Tomo742

    Tomo742 Guest

    Re: Faction Character Creation Skins/bodygroups

    Doesn't matter, I made a work around and set the characters data and then loaded it and what not using these where needed -

    Code:
    local skin = player:GetCharacterData("Skin") or 0;
    player:SetCharacterData("Skin", skin);
     
  8. Re: Faction Character Creation Skins/bodygroups

    Last time I checked CW doesn't set skins/bodygroups based on character data.

    You really should start posting the solutions to stuff you find, Tomo. It makes it easier to resolve the issue if it reappears in the future.
     
  9. Tomo742

    Tomo742 Guest

    Re: Faction Character Creation Skins/bodygroups

    But I did post the solutions to the stuff I found, I stated what I used in order to get and set character data. What you do is what skin you want the character to start off with when the character is made you set the characters data

    Code:
    player:SetCharacterData("Skin", 1);
    "1" is the example we used for the skin number we want, then when the character loads we need to set it so we use -

    Code:
    local skin = player:GetCharacterData("Skin") or 0;
    This sets the local variable "skin" to the value of "Skin" within player:GetCharacterData or 0 if it cannot find the value.

    You then use player:SetSkin(skin), this sets the value of the players skin to the local variable of "Skin"
     
  10. Right. I thought you said player:SetSkin() didn't work, you see. Thanks for posting the solution, though.
     
  11. Tomo742

    Tomo742 Guest

    Ah sorry, what actually didn't work was the code you sent. I think it's because it can't set it instantly upon character loading but... Yeah.
     

Previous Readers (Total: 0)