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!

HL2RP Guys plx help

Discussion in 'Development' started by DeathRider, Jul 2, 2018.

  1. How to change faction after use item?
     
  2. Viz

    Viz Legend Clockwork Customer

    Could you clarify a bit more? You should be able to change faction after using an item.
     
  3. I think he means, changing the character faction after using a item.. like a MPF cloaker
     
    • Agree Agree x 1
  4. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Retard Clockwork Customer

    Not to necro but assuming Defalt is correct about what the OP is looking for I whipped up a thing.

    Code:
    function ITEM:OnUse(player, itemEntity)
        player:SetCharacterData( "customclass", "custom class here in quotes" );
    end;
    
    Just replace whatever use function is in your item file's code with this and it will set the custom class of the character to whatever you set "custom class here in quotes" to. Make sure that it follows the syntax "Custom Class" so that if you want to set them to City Administrator you'd put "City Administrator" there.

    Edit: Yep I figured I was necroing... my bad. I haven't been on here in awhile (just got back on a couple of days ago) and forgot what the day limit was... please don't ban me.
     
  5. _HappyGoLucky

    _HappyGoLucky Clockwork Customer

    he wants faction, not custom class i believe
    Code:
    function ITEM:OnUse(player, itemEntity)
        local newFaction = FACTION_*****
        if (player:GetFaction() != newFaction) then
            player:SetCharacterData("Faction", newFaction, true);
            Clockwork.player:LoadCharacter(player, Clockwork.player:GetCharacterID(player));
        else
            Clockwork.player:Notify(player, "You are already the given faction!")
        end
    end;
    
    that should work
     
    Last edited: Nov 24, 2018
  6. Viz

    Viz Legend Clockwork Customer

    Should be ITEM:OnUse, not ITEM:OnUsed.
     
    • Good Coder Good Coder x 1
  7. _HappyGoLucky

    _HappyGoLucky Clockwork Customer

    ahaha oops yes
     

Previous Readers (Total: 0)