Raised This Month: $ Target: $400
 0% 

Replace map medikits with Halloween versions. (Code included)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Smarmy
Senior Member
Join Date: Mar 2012
Old 10-21-2012 , 14:51   Replace map medikits with Halloween versions. (Code included)
Reply With Quote #1

Hello,

I have some code here written by Dr. McKay which attempts to do this but he currently doesn't have time to complete what's currently wrong with it. Right now it removes the kits but doesn't replace them.

Code:
#include <sourcemod>
#include <sdktools>
	#include <sdkhooks>
	
	public Plugin:myinfo = {
	        name = "[TF2] Halloween Health Packs",
	        author = "Dr. McKay",
	        description = "Changes regular health packs to Halloween health packs",
	        version = "1.0.0",
	        url = "http://www.doctormckay.com"
	}
	
	new bool:ignoreNextEntity = false;
	new bool:mapRunning = false;
	
	public OnMapStart() {
	        PrecacheModel("models/props_halloween/halloween_medkit_large.mdl");
	        PrecacheModel("models/props_halloween/halloween_medkit_medium.mdl");
	        PrecacheModel("models/props_halloween/halloween_medkit_small.mdl");
	        mapRunning = true;
	}
	
	public OnMapEnd() {
	        mapRunning = false;
	}
	
	public OnEntityCreated(entity, const String:classname[]) {
	        if(ignoreNextEntity) {
	                ignoreNextEntity = false;
	                LogMessage("Ignored entity");
	                return;
	        }
	        if(!mapRunning) {
	                return;
	        }
	        decl String:model[128];
	       
	        if(StrEqual(classname, "item_healthkit_full")) {
	                Format(model, sizeof(model), "models/props_halloween/halloween_medkit_large.mdl");
	        } else if(StrEqual(classname, "item_healthkit_medium")) {
	                Format(model, sizeof(model), "models/props_halloween/halloween_medkit_medium.mdl");
	        } else if(StrEqual(classname, "item_healthkit_small")) {
	                Format(model, sizeof(model), "models/props_halloween/halloween_medkit_small.mdl");
	        } else {
	                return; // not a healthpack
	        }
	       
	        new Float:pos[3];
	        GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
	        AcceptEntityInput(entity, "kill");
	       
	        ignoreNextEntity = true;
	        entity = CreateEntityByName(classname);
	        DispatchKeyValue(entity, "OnPlayerTouch", "!self,Kill,,0,-1");
	        DispatchKeyValue(entity, "powerup_model", model);
	        DispatchSpawn(entity);
	        SetEntProp(entity, Prop_Send, "m_iTeamNum", 0, 4);
	        TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
	}
Thank you.
Attached Files
File Type: sp Get Plugin or Get Source (medikit_replacer.sp - 452 views - 2.2 KB)
Smarmy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode