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!

Adding new CCA/MPF rank?

Discussion in 'Discussion' started by ZeroPie, Mar 31, 2013.

  1. Alright so I've been trying to figure this out for a bit.
    Basicly what I wanted to do is add a new rank to the Civil Protection, this rank would be 'CmD'.
    What I need help with is how do I set this rank to have the permissions to use /dispatch and so on, like the SeC or a DvL can?

    Help is very appreciated. :>
     
  2. Add another class
     
  3. connall

    connall Guest

    That wouldn't help the underlying problem.
     
  4. He doesn't need to do that. Just needs to go into the dispatch code.

    @OP, what do you mean and so on?
     
  5. Alright so, to be a bit more clear about the problem.
    We want to make the 'CmD' rank a scripted rank wich would give the unit with CmD in his name the same permissions to /dispatch and access to the Elite Metropolice things in a salesman entity as the SeC or a DvL would.
    I have already added the CmD rank so it sets the model we want it to use.
    We are using CCA.C17-CmD-DvL.### as of now wich doesn't look too good, and it sets the model to DvL.
     
  6. connall

    connall Guest

    Dispatch can be done with a simple code change. Find the commands folder and dispatch and remove everything in there and replace it with this.

    Code:
    --[[
    	© 2013 CloudSixteen.com do not share, re-distribute or modify
    	without permission of its author ([email protected]).
    --]]
    
    local COMMAND = Clockwork.command:New("Dispatch");
    COMMAND.tip = "Dispatch a message to all characters.";
    COMMAND.text = "<string Text>";
    COMMAND.flags = bit.bor(CMD_DEFAULT, CMD_FALLENOVER);
    COMMAND.arguments = 1;
    
    -- Called when the command has been run.
    function COMMAND:OnRun(player, arguments)
    	if (Schema:PlayerIsCombine(player)) then
    		if (Schema:IsPlayerCombineRank( player, {"SCN", "DvL", "SeC", "CmD"} ) or player:GetFaction() == FACTION_OTA) then
    			local text = table.concat(arguments, " ");
    			
    			if (text == "") then
    				Clockwork.player:Notify(player, "You did not specify enough text!");
    				
    				return;
    			end;
    			
    			Schema:SayDispatch(player, text);
    		else
    			Clockwork.player:Notify(player, "You are not ranked high enough to use this command!");
    		end;
    	else
    		Clockwork.player:Notify(player, "You are not the Combine!");
    	end;
    end;
    
    COMMAND:Register();
    
    Now regarding the model change open up sv_hooks find a function that looks like this
    Code:
    -- Called when a player's default model is needed.
    function Schema:GetPlayerDefaultModel(player)
    	local faction = player:GetFaction();
    	
    	if (self:IsCombineFaction(faction)) then
    		if (self:IsPlayerCombineRank(player, "GHOST")) then
    			return "models/eliteghostcp.mdl";
    		elseif (self:IsPlayerCombineRank(player, "OfC")) then
    			return "models/policetrench.mdl";
    		elseif (self:IsPlayerCombineRank(player, "DvL")) then
    			return "models/eliteshockcp.mdl";
    
    		end;
    	end;
    end;
    
    I can almost guarantee that you won't have to scroll down or if you do, not that far. Replace that function (DO NOT REPLACE ENTIRE FILE WITH THIS ONE FUNCTION OR IT WILL BE FUCKED) with this
    Code:
    -- Called when a player's default model is needed.
    function Schema:GetPlayerDefaultModel(player)
    	local faction = player:GetFaction();
    	
    	if (self:IsCombineFaction(faction)) then
    		if (self:IsPlayerCombineRank(player, "GHOST")) then
    			return "models/eliteghostcp.mdl";
    		elseif (self:IsPlayerCombineRank(player, "OfC")) then
    			return "models/policetrench.mdl";
    		elseif (self:IsPlayerCombineRank(player, "DvL")) then
    			return "models/eliteshockcp.mdl";
    		elseif (self:IsPlayerCombineRank(player, "SeC")) then
    			return "models/sect_police2.mdl";
    		elseif (self:IsPlayerCombineRank(player, "CmD")) then
    			return "yourmodelpathwayhere"
    		end;
    	end;
    end;
    
    With the "yourmodelpathwayhere" being the model path for whatever you want the CmD to have.

    Now class wise. I'm not going to lie, I've never understood how Clockwork assigns classes except that of the default class so someone else will need to explain that, unless I figure it out before there's a reply.

    Remember to backup the original version of the files and these updated ones, since as soon as there is an update to hl2rp and you apply it, the files will be replaced to the originals again.
     
  7. Thank you very much! :3
     
  8. connall

    connall Guest

    Not a problem.
     

Previous Readers (Total: 0)