1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
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 Active Member

    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 Active Member

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

    function ITEM:OnUse(player, itemEntity)
        player:SetCharacterData( "customclass", "custom class here in quotes" );
    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 Active Member

    he wants faction, not custom class i believe
    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));
            Clockwork.player:Notify(player, "You are already the given faction!")
    that should work
    Last edited: Nov 24, 2018
  6. Viz

    Viz Legend Clockwork Customer Active Member

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

    _HappyGoLucky Clockwork Customer Active Member

    ahaha oops yes

Previous Readers (Total: 0)