Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ITEM:PreChangeModel(player, bIsWearing)
- local faction = self("changeFaction");
- local accessoryData = player:GetAccessoryData();
- if (faction and !player.changingFaction and !player.changingClass) then
- if (bIsWearing) then
- self:ChangeFaction(player, faction);
- else
- self:ChangeFaction(player, "Citizen");
- end;
- end;
- end;
- function ITEM:ChangeFaction(player, faction)
- local factionTable = CW.faction:FindByID(faction);
- if (factionTable) then
- player:SetCharacterData("Faction", factionTable.name, true);
- CW.player:SetWhitelisted(player, factionTable.name, true);
- CW.player:SaveCharacter(player);
- if (player:HasInitialized()) then
- local pos, ang = player:GetPos(), player:EyeAngles();
- CW.player:Notify(player, "You are now part of the "..factionTable.name.." faction.");
- -- This variable is to stop scary stack overflow issues.
- player.changingFaction = true;
- CW.player:LoadCharacter(player, CW.player:GetCharacterID(player));
- player.changingFaction = nil;
- player:SetPos(pos);
- player:SetEyeAngles(ang);
- end;
- end;
- end;
- --3:18 PM - skoden is now Online.
- 3:22 PM - skoden: https://pastebin.com/fiTqDPwy
- 3:23 PM - skoden: In apparel items use ITEM.changeFaction = "name";
- 3:23 PM - skoden: the stuff i linked goes in your apparel base
- 3:29 PM - skoden: paste it right in your apparel or item base depending on what you are using it with
Advertisement
Add Comment
Please, Sign In to add comment