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!

'IsCombineRank' a nil value.

Discussion in 'Development' started by Vortix, Jul 23, 2014.

  1. Vortix

    Vortix Moderator Staff Member Moderator Legend Clockwork Customer

    I wrote the line:
    if(Schema:IsCombineRank(player, "i5")) then
    However that seems to bring up an error:
    The 'GetPlayerDefaultModel' plugin hook has failed to run. gamemodes/cwhl2rp/plugins/mpfmodelset/plugin/sv_hooks.lua:13: attempt to call method 'IsCombineRank' (a nil value)
    Any advice?
     
  2. trurascalz

    trurascalz C16 Developer Legend

    Wont get much help without full code. Initially player doesnt exist is wnat its saying
     
  3. Vortix

    Vortix Moderator Staff Member Moderator Legend Clockwork Customer

    Full code:
    Code:
    local PLUGIN = PLUGIN
    
    function PLUGIN:GetPlayerDefaultModel(player)
    	local faction = player:GetFaction();
    	if (Schema:IsCombineFaction(faction)) then
    		if (Schema:IsPlayerCombineRank(player, "JUDGE")) then
    			if(Schema:IsCombineRank(player, "i5")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "i4")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "i3")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "i2")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "i1")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "EpU")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "OfC")) then
    				return "models/dpfilms/metropolice/retrocop.mdl"
    			elseif(Schema:IsCombineRank(player, "SqL")) then
    				return "models/dpfilms/metropolice/hl2beta_police.mdl"
    			elseif(Schema:IsCombineRank(player, "DvL")) then
    				return "models/dpfilms/metropolice/rtb_police.mdl"
    			end
    		elseif (Schema:IsPlayerCombineRank(player, "HELIX")) then
    			if(Schema:IsCombineRank(player, "i5")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "i4")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "i3")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "i2")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "i1")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "EpU")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "OfC")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "SqL")) then
    				return "models/dpfilms/metropolice/civil_medic.mdl"
    			elseif(Schema:IsCombineRank(player, "DvL")) then
    				return "models/dpfilms/metropolice/biopolice.mdl"
    			end
    		elseif (Schema:IsPlayerCombineRank(player, "UNION")) then
    			if(Schema:IsCombineRank(player, "i5")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "i4")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "i3")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "i2")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "i1")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "EpU")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "OfC")) then
    				return "models/dpfilms/metropolice/hdpolice.mdl"
    			elseif(Schema:IsCombineRank(player, "SqL")) then
    				return "models/dpfilms/metropolice/hl2concept.mdl"
    			elseif(Schema:IsCombineRank(player, "DvL")) then
    				return "models/dpfilms/metropolice/elite_police.mdl"
    			end
    		elseif (Schema:IsPlayerCombineRank(player, "SWORD")) then
    			if(Schema:IsCombineRank(player, "OfC")) then
    				return "models/dpfilms/metropolice/urban_police.mdl"
    			elseif(Schema:IsCombineRank(player, "SqL")) then
    				return "models/dpfilms/metropolice/urban_police.mdl"
    			elseif(Schema:IsCombineRank(player, "DvL")) then
    				return "models/dpfilms/metropolice/police_fragger.mdl"
    			end
    		elseif (Schema:IsPlayerCombineRank(player, "GRID")) then
    			if(Schema:IsCombineRank(player, "i5")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "i4")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "i3")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "i2")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "i1")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "EpU")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "OfC")) then
    				return "models/dpfilms/metropolice/tron_police.mdl"
    			elseif(Schema:IsCombineRank(player, "SqL")) then
    				return "models/dpfilms/metropolice/hunter_police.mdl"
    			elseif(Schema:IsCombineRank(player, "DvL")) then
    				return "models/eliteshockcp.mdl"
    			end
    		elseif (Schema:IsPlayerCombineRank(player, "CmD")) then
    			return "models/dpfilms/metropolice/phoenix_police.mdl"
    		elseif (Schema:IsPlayerCombineRank(player, "SeC")) then
    			return "models/dpfilms/metropolice/blacop.mdl"
    		end;
    	end;
    end;
    
    function PLUGIN:PlayerNameChanged(player, previousName, newName)
    	if (Schema:PlayerIsCombine(player)) then
    		local faction = player:GetFaction();
    		if (Schema:IsStringCombineRank(newName, "JUDGE")) then
    			if (Schema:IsStringCombineRank(newName, "i5")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i4")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i3")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i2")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i1")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "EpU")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "OfC")) then
    				player:SetModel("models/dpfilms/metropolice/retrocop.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "SqL")) then
    				player:SetModel("models/dpfilms/metropolice/hl2beta_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "DvL")) then
    				player:SetModel("models/dpfilms/metropolice/rtb_police.mdl");
    			end;
    		elseif (Schema:IsStringCombineRank(newName, "HELIX")) then
    			if (Schema:IsStringCombineRank(newName, "i5")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i4")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i3")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i2")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i1")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "EpU")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "OfC")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "SqL")) then
    				player:SetModel("models/dpfilms/metropolice/civil_medic.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "DvL")) then
    				player:SetModel("models/dpfilms/metropolice/biopolice.mdl");
    			end;
    		elseif (Schema:IsStringCombineRank(newName, "UNION")) then
    			if (Schema:IsStringCombineRank(newName, "i5")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i4")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i3")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i2")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i1")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "EpU")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "OfC")) then
    				player:SetModel("models/dpfilms/metropolice/hdpolice.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "SqL")) then
    				player:SetModel("models/dpfilms/metropolice/hl2concept.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "DvL")) then
    				player:SetModel("models/dpfilms/metropolice/elite_police.mdl");
    			end;
    		elseif (Schema:IsStringCombineRank(newName, "SWORD")) then
    			if (Schema:IsStringCombineRank(newName, "OfC")) then
    				player:SetModel("models/dpfilms/metropolice/urban_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "SqL")) then
    				player:SetModel("models/dpfilms/metropolice/urban_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "DvL")) then
    				player:SetModel("models/dpfilms/metropolice/police_fragger.mdl");
    			end;
    		elseif (Schema:IsStringCombineRank(newName, "GRID")) then
    			if (Schema:IsStringCombineRank(newName, "i5")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i4")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i3")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i2")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "i1")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "EpU")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "OfC")) then
    				player:SetModel("models/dpfilms/metropolice/tron_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "SqL")) then
    				player:SetModel("models/dpfilms/metropolice/hunter_police.mdl");
    			elseif (Schema:IsStringCombineRank(newName, "DvL")) then
    				player:SetModel("models/eliteshockcp.mdl");
    			end;
    		elseif (Schema:IsStringCombineRank(newName, "CmD")) then
    			player:SetModel("models/dpfilms/metropolice/phoenix_police.mdl");
    		elseif (Schema:IsStringCombineRank(newName, "SeC")) then
    			player:SetModel("models/dpfilms/metropolice/blacop.mdl");
    		end;
    	end;
    end
    function PLUGIN:PlayerAdjustCharacterScreenInfo(player, character, info)
    	if (Schema:IsCombineFaction(info.faction)) then
    		if (self:IsStringCombineRank(info.name, "SeC")) then
    			info.model = "models/dpfilms/metropolice/blacop.mdl";
    		elseif (self:IsStringCombineRank(info.name, "CmD")) then
    			info.model = "models/dpfilms/metropolice/phoenix_police.mdl";
    		elseif (self:IsStringCombineRank(info.name, "JUDGE")) then
    			if (self:IsStringCombineRank(info.name, "i5")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i4")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i3")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i2")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i1")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "OfC")) then
    				info.model = "models/dpfilms/metropolice/retrocop.mdl";
    			elseif (self:IsStringCombineRank(info.name, "SqL")) then
    				info.model = "models/dpfilms/metropolice/hl2beta_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "DvL")) then
    				info.model = "models/dpfilms/metropolice/rtb_police.mdl";
    			end;
    		elseif (self:IsStringCombineRank(info.name, "HELIX")) then
    			if (self:IsStringCombineRank(info.name, i5)) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i4")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i3")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i2")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i1")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "OfC")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "SqL")) then
    				info.model = "models/dpfilms/metropolice/civil_medic.mdl";
    			elseif (self:IsStringCombineRank(info.name, "DvL")) then
    				info.model = "models/dpfilms/metropolice/biopolice.mdl";
    			end;
    		elseif (self:IsStringCombineRank(info.name, "UNION")) then
    			if (self:IsStringCombineRank(info.name, "i5")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i4")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i3")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i2")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i1")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "OfC")) then
    				info.model = "models/dpfilms/metropolice/hdpolice.mdl";
    			elseif (self:IsStringCombineRank(info.name, "SqL")) then
    				info.model = "models/dpfilms/metropolice/hl2concept.mdl";
    			elseif (self:IsStringCombineRank(info.name, "DvL")) then
    				info.model = "models/dpfilms/metropolice/elite_police.mdl";
    			end;
    		elseif (self:IsStringCombineRank(info.name, "SWORD")) then
    			if (self:IsStringCombineRank(info.name, "OfC")) then
    				info.model = "models/dpfilms/metropolice/urban_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "SqL")) then
    				info.model = "models/dpfilms/metropolice/urban_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "DvL")) then
    				info.model = "models/dpfilms/metropolice/police_fragger.mdl";
    			end;
    		elseif (self:IsStringCombineRank(info.name, "GRID")) then
    			if (self:IsStringCombineRank(info.name, "i5")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i4")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i3")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i2")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "i1")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "OfC")) then
    				info.model = "models/dpfilms/metropolice/tron_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "SqL")) then
    				info.model = "models/dpfilms/metropolice/hunter_police.mdl";
    			elseif (self:IsStringCombineRank(info.name, "DvL")) then
    				info.model = "models/eliteshockcp.mdl";
    			end;
    		end;
    	end;
    end;
     
  4. NightAngel

    NightAngel Fuck off Lev

    Schema:IsCombineRank will only work with the 05-01 ranking system. I'd recommend making your own plugin function that uses string.find(name, "rank"). Also, tables, tables are good for you. I just kinda stopped scrollin down the endless pit of elseifs. xP
     
  5. Vortix

    Vortix Moderator Staff Member Moderator Legend Clockwork Customer

    Ah, right. So would:
    if (string.find(player, "i5")) then
    work as a suitable replacement?
    Also, the reason I don't use tables is to allow easy editing of the models from i5-OfC.

    EDIT: Tested and it didn't seem to work. Got the error: (expected string, got userdata)
     
  6. trurascalz

    trurascalz C16 Developer Legend

    Code:
    if (string.find(player:Name(), "i5")) 
    player:Name()
     
  7. Vortix

    Vortix Moderator Staff Member Moderator Legend Clockwork Customer

    Great, it's working perfectly now!
    Thanks to the both of you.
     

Previous Readers (Total: 0)