Page 1 of 1

Help to add P_KNIFE_MODEL

Posted: 14 Mar 2017, 17:19
by johnnysins2000
HELLO Guys Can Somebody Tell me how to add P _Knife_ Model in this ze_resources

Code: Select all

#include <zombie_escape>

// Setting File
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"

// Defines
#define MODEL_MAX_LENGTH 64
#define PLAYERMODEL_MAX_LENGTH 32
#define SOUND_MAX_LENGTH 64
#define TASK_AMBIENCESOUND 2020
#define TASK_REAMBIENCESOUND 5050

// Default Sounds
new const szReadySound[][] = 
{
	"zombie_escape/ze_ready.mp3"
}

new const szInfectSound[][] = 
{
	"zombie_escape/zombie_infect_1.wav",
	"zombie_escape/zombie_infect_2.wav"
}

new const szComingSound[][] = 
{
	"zombie_escape/zombie_coming_1.wav",
	"zombie_escape/zombie_coming_2.wav",
	"zombie_escape/zombie_coming_3.wav"
}

new const szPreReleaseSound[][] = 
{
	"zombie_escape/ze_pre_release.wav"
}

new const szAmbianceSound[][] = 
{
	"zombie_escape/ze_ambiance1.mp3",
	"zombie_escape/ze_ambiance2.mp3"
}

new const szEscapeSuccessSound[][] = 
{
	"zombie_escape/escape_success.wav"
}

new const szEscapeFailSound[][] = 
{
	"zombie_escape/escape_fail.wav"
}

// Default Sounds Duration (Hardcoded Values)
new g_iReadySoundDuration = 19
new g_iPreReleaseSoundDuration = 19
new g_iAmbianceSoundDuration = 160 //(Avarage for the 2 ambiances)


// Default Models
new const szHostZombieModel[][] =
{
	"host_zombie"
}

new const szOriginZombieModel[][] =
{
	"origin_zombie"
}

new const szHumanModels[][] = // These models not prechaced as it's default in cs
{
	"arctic",
	"gign",
	"gsg9",
	"guerilla",
	"leet",
	"sas",
	"terror",
	"urban"
}

new const v_szZombieKnifeModel[][] =
{
	"models/zombie_escape/v_knife_zombie.mdl"
}

new const v_szHumanKnifeModel[][] = 
{
	"models/v_knife.mdl"
}

// Dynamic Arrays: Sounds
new Array:g_szReadySound, Array:g_szInfectSound, Array:g_szComingSound, Array:g_szPreReleaseSound,
Array:g_szAmbianceSound, Array:g_szEscapeSuccessSound, Array:g_szEscapeFailSound

// Dynamic Arrays: Models
new Array:g_szHostZombieModel, Array:g_szOriginZombieModel, Array:g_v_szZombieKnifeModel,
Array:g_v_szHumanKnifeModel

public plugin_init()
{
	register_plugin("[ZE] Models & Sounds", ZE_VERSION, AUTHORS)
}

public plugin_precache()
{	
	// Initialize Arrays: Sounds
	g_szReadySound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szInfectSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szComingSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szPreReleaseSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szAmbianceSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szEscapeSuccessSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szEscapeFailSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	
	// Load From External File: Sounds
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
	
	// Load our Default Values: Sounds
	new iIndex
	
	if(ArraySize(g_szReadySound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szReadySound; iIndex++)
			ArrayPushString(g_szReadySound, szReadySound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
	}
	
	if(ArraySize(g_szInfectSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szInfectSound; iIndex++)
			ArrayPushString(g_szInfectSound, szInfectSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
	}
	
	if(ArraySize(g_szComingSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szComingSound; iIndex++)
			ArrayPushString(g_szComingSound, szComingSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
	}
	
	if(ArraySize(g_szPreReleaseSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szPreReleaseSound; iIndex++)
			ArrayPushString(g_szPreReleaseSound, szPreReleaseSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
	}
	
	if(ArraySize(g_szAmbianceSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szAmbianceSound; iIndex++)
			ArrayPushString(g_szAmbianceSound, szAmbianceSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
	}
	
	if(ArraySize(g_szEscapeSuccessSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szEscapeSuccessSound; iIndex++)
			ArrayPushString(g_szEscapeSuccessSound, szEscapeSuccessSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
	}
	
	if(ArraySize(g_szEscapeFailSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szEscapeFailSound; iIndex++)
			ArrayPushString(g_szEscapeFailSound, szEscapeFailSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
	}
	
	// Precache: Sounds
	new szSound[SOUND_MAX_LENGTH]
	
	for (iIndex = 0; iIndex < ArraySize(g_szReadySound); iIndex++)
	{
		ArrayGetString(g_szReadySound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szInfectSound); iIndex++)
	{
		ArrayGetString(g_szInfectSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szComingSound); iIndex++)
	{
		ArrayGetString(g_szComingSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szPreReleaseSound); iIndex++)
	{
		ArrayGetString(g_szPreReleaseSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szAmbianceSound); iIndex++)
	{
		ArrayGetString(g_szAmbianceSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szEscapeSuccessSound); iIndex++)
	{
		ArrayGetString(g_szEscapeSuccessSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szEscapeFailSound); iIndex++)
	{
		ArrayGetString(g_szEscapeFailSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	// Sound Durations
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration)
	
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration)
	
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration)
	
	// Initialize Arrays: Models
	g_szHostZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szOriginZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_v_szZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	g_v_szHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	
	// Load From External File: Models
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
	
	// Load our Default Values: Models
	if(ArraySize(g_szHostZombieModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHostZombieModel; iIndex++)
			ArrayPushString(g_szHostZombieModel, szHostZombieModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
	}
	
	if(ArraySize(g_szOriginZombieModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szOriginZombieModel; iIndex++)
			ArrayPushString(g_szOriginZombieModel, szOriginZombieModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
	}
	
	if(ArraySize(g_v_szZombieKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szZombieKnifeModel; iIndex++)
			ArrayPushString(g_v_szZombieKnifeModel, v_szZombieKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
	}
	
	if(ArraySize(g_v_szHumanKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szHumanKnifeModel; iIndex++)
			ArrayPushString(g_v_szHumanKnifeModel, v_szHumanKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
	}
	
	// Precache: Models
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
	
	for (iIndex = 0; iIndex < ArraySize(g_szHostZombieModel); iIndex++)
	{
		ArrayGetString(g_szHostZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szOriginZombieModel); iIndex++)
	{
		ArrayGetString(g_szOriginZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szZombieKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szZombieKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szHumanKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szHumanKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
}

// Play Ready sound only if game started
public ze_game_started()
{
	// Remove Tasks (Again as somehow may it not removed at the roundend)
	remove_task(TASK_AMBIENCESOUND)
	remove_task(TASK_REAMBIENCESOUND)
	
	// Stop All Sounds
	StopSound()
	
	// Play Ready Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szReadySound, random_num(0, ArraySize(g_szReadySound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_user_infected(iVictim, iInfector)
{	
	// Emit Sound For infection (Sound Source is The zombie Body)
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szInfectSound, random_num(0, ArraySize(g_szInfectSound) - 1), szSound, charsmax(szSound))
	emit_sound(iVictim, CHAN_BODY, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
	
	// Play Zombie Appear Sound for all Players
	ArrayGetString(g_szComingSound, random_num(0, ArraySize(g_szComingSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
	
	// Set Zombie Models
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
	
	// Random Model Set
	switch(random_num(0, 130))
	{
		case 0..30:
		{
			ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel) // This native Faster 100000000000 times than one in fun module
		}
		case 31..70:
		{
			ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
		case 71..100:
		{
			ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
		case 101..130:
		{
			ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
	}
	
	ArrayGetString(g_v_szZombieKnifeModel, random_num(0, ArraySize(g_v_szZombieKnifeModel) - 1), szModel, charsmax(szModel))
	cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
	cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
}

public ze_zombie_appear()
{
	// Add Delay to let Infection Sound to complete
	set_task(3.0, "ZombieAppear", _, _, _, "a", 1)
}

public ZombieAppear()
{	
	// Play Pre-Release Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szPreReleaseSound, random_num(0, ArraySize(g_szPreReleaseSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_zombie_release()
{
	// Add Delay to make sure Pre-Release Sound Finished
	set_task(float((g_iPreReleaseSoundDuration) - (ze_get_release_time() - 3)), "AmbianceSound", TASK_AMBIENCESOUND, _, _, "a", 1)
}

public AmbianceSound()
{
	// Stop All Sounds
	StopSound()
	
	// Play The Ambiance Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
	
	// We should Set Task back again to replay (Repeated 5 times MAX)
	set_task(float(g_iAmbianceSoundDuration), "RePlayAmbianceSound", TASK_REAMBIENCESOUND, _, _, "a", 5)
}

public RePlayAmbianceSound()
{
	// Play The Ambiance Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_user_humanized(id)
{
	if(ze_is_user_zombie(id) || !is_user_alive(id))
		return
	
	// Rest Player Model (Model Randomly)
	rg_set_user_model(id, szHumanModels[random_num(0, charsmax(szHumanModels))])
		
	// Rest Player view Knife model
	new szModel[MODEL_MAX_LENGTH]
	ArrayGetString(g_v_szHumanKnifeModel, random_num(0, ArraySize(g_v_szHumanKnifeModel) - 1), szModel, charsmax(szModel))
	cs_set_player_view_model(id, CSW_KNIFE, szModel)
	
}

public ze_roundend(WinTeam)
{
	remove_task(TASK_AMBIENCESOUND)
	remove_task(TASK_REAMBIENCESOUND)
	StopSound()
	
	new szSound[SOUND_MAX_LENGTH]
	
	if (WinTeam == ZE_TEAM_ZOMBIE)
	{
		ArrayGetString(g_szEscapeFailSound, random_num(0, ArraySize(g_szEscapeFailSound) - 1), szSound, charsmax(szSound))
		PlaySound(0, szSound)
	}
	
	if (WinTeam == ZE_TEAM_HUMAN)
	{
		ArrayGetString(g_szEscapeSuccessSound, random_num(0, ArraySize(g_szEscapeSuccessSound) - 1), szSound, charsmax(szSound))
		PlaySound(0, szSound)
	}
}

Re: Help to add P_KNIFE_MODEL

Posted: 14 Mar 2017, 19:39
by johnnysins2000
ok I have done it myself But i need someone to look at my code it is correct

Code: Select all

#include <zombie_escape>

// Setting File
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"

// Defines
#define MODEL_MAX_LENGTH 64
#define PLAYERMODEL_MAX_LENGTH 32
#define ACCESS_MAX_LENGTH 32
#define ADMIN_MODELS_ACCESS ADMIN_LEVEL_H

// Default Models
new const szAdminHumanModel[][] = 
{
	"vip"
}

new const szAdminZombieModel[][] = 
{
	"zombie_admin"
}

new const v_szAdminHumanKnifeModel[][] = 
{
	"models/zombie_escape/v_knife_human_admin.mdl"
}

new const p_szAdminHumanKnifeModel[][] = 
{
	"models/zombie_escape/p_knife_human_admin.mdl" 
} 

new const v_szAdminZombieKnifeModel[][] = 
{
	"models/zombie_escape/v_knife_zombie_admin.mdl"
}

new const szHumanModel1[][] = 
{
	"human1"
}

new const szHumanModel2[][] = 
{
	"human2"
}

new const szHumanModel3[][] = 
{
	"human3"
}

new const szHumanModel4[][] = 
{
	"human4"
}

// Dynamic Arrays: Models
new Array:g_szAdminHumanModel, Array:g_szAdminZombieModel, Array:g_v_szAdminHumanKnifeModel, Array:g_p_szAdminHumanKnifeModel, Array:g_v_szAdminZombieKnifeModel, 
Array:g_szHumanModel1, Array:g_szHumanModel2, Array:g_szHumanModel3, Array:g_szHumanModel4

public plugin_init()
{
	register_plugin("[ZE] Special Models", ZE_VERSION, AUTHORS)
}

public plugin_precache()
{
	// Initialize Arrays
	g_szAdminHumanModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szAdminZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_v_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	g_p_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	g_v_szAdminZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	g_szHumanModel1 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szHumanModel2 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szHumanModel3 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szHumanModel4 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	
	// Load From External File
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN ADMIN", g_szAdminHumanModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE ADMIN", g_szAdminZombieModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN ADMIN", g_v_szAdminHumanKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN ADMIN", g_v_szAdminHumanKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE ADMIN", g_v_szAdminZombieKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 1", g_szHumanModel1)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 2", g_szHumanModel2)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 3", g_szHumanModel3)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 4", g_szHumanModel4)
	
	// Load our Default Values
	new iIndex
	
	if(ArraySize(g_szAdminHumanModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szAdminHumanModel; iIndex++)
			ArrayPushString(g_szAdminHumanModel, szAdminHumanModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN ADMIN", g_szAdminHumanModel)
	}
	
	if(ArraySize(g_szAdminZombieModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szAdminZombieModel; iIndex++)
			ArrayPushString(g_szAdminZombieModel, szAdminZombieModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE ADMIN", g_szAdminZombieModel)
	}
	
	if(ArraySize(g_v_szAdminHumanKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szAdminHumanKnifeModel; iIndex++)
			ArrayPushString(g_v_szAdminHumanKnifeModel, v_szAdminHumanKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN ADMIN", g_v_szAdminHumanKnifeModel)
	}
	
	if(ArraySize(g_v_szAdminHumanKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof p_szAdminHumanKnifeModel; iIndex++)
			ArrayPushString(g_p_szAdminHumanKnifeModel, p_szAdminHumanKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN ADMIN", g_p_szAdminHumanKnifeModel)
	} 
	
	if(ArraySize(g_v_szAdminZombieKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szAdminZombieKnifeModel; iIndex++)
			ArrayPushString(g_v_szAdminZombieKnifeModel, v_szAdminZombieKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE ADMIN", g_v_szAdminZombieKnifeModel)
	}
	
	if(ArraySize(g_szHumanModel1) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHumanModel1; iIndex++)
			ArrayPushString(g_szHumanModel1, szHumanModel1[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 1", g_szHumanModel1)
	}
	
	if(ArraySize(g_szHumanModel2) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHumanModel2; iIndex++)
			ArrayPushString(g_szHumanModel2, szHumanModel2[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 2", g_szHumanModel2)
	}
	
	if(ArraySize(g_szHumanModel3) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHumanModel3; iIndex++)
			ArrayPushString(g_szHumanModel3, szHumanModel3[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 3", g_szHumanModel3)
	}
	
	if(ArraySize(g_szHumanModel4) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHumanModel4; iIndex++)
			ArrayPushString(g_szHumanModel4, szHumanModel4[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 4", g_szHumanModel4)
	}

	// Precache
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
	
	for (iIndex = 0; iIndex < ArraySize(g_szAdminHumanModel); iIndex++)
	{
		ArrayGetString(g_szAdminHumanModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szAdminZombieModel); iIndex++)
	{
		ArrayGetString(g_szAdminZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szHumanModel1); iIndex++)
	{
		ArrayGetString(g_szHumanModel1, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szHumanModel2); iIndex++)
	{
		ArrayGetString(g_szHumanModel2, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szHumanModel3); iIndex++)
	{
		ArrayGetString(g_szHumanModel3, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szHumanModel4); iIndex++)
	{
		ArrayGetString(g_szHumanModel4, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szAdminHumanKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_p_szAdminHumanKnifeModel); iIndex++)
	{
		ArrayGetString(g_p_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel) 
	} 
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szAdminZombieKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szAdminZombieKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
}

public ze_user_humanized(id)
{
	if(ze_is_user_zombie(id) || !is_user_alive(id))
		return
		
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]

	// Player Admin?
	if(get_user_flags(id) & ADMIN_MODELS_ACCESS)
	{
		// Set Admin Human Model
		ArrayGetString(g_szAdminHumanModel, random_num(0, ArraySize(g_szAdminHumanModel) - 1), szPlayerModel, charsmax(szPlayerModel))
		rg_set_user_model(id, szPlayerModel)
		
		// Set Admin Human Knife Model
		ArrayGetString(g_v_szAdminHumanKnifeModel, random_num(0, ArraySize(g_v_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
		cs_set_player_view_model(id, CSW_KNIFE, szModel)
		ArrayGetString(g_p_szAdminHumanKnifeModel, random_num(0, ArraySize(g_p_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
		cs_set_player_view_model(id, CSW_KNIFE, szModel)
	}
	else
	{
		// Rest Player Model (Model Randomly)
		switch(random_num(0, 130))
		{
			case 0..30:
			{
				ArrayGetString(g_szHumanModel1, random_num(0, ArraySize(g_szHumanModel1) - 1), szPlayerModel, charsmax(szPlayerModel))
				rg_set_user_model(id, szPlayerModel)
			}
			case 31..70:
			{
				ArrayGetString(g_szHumanModel2, random_num(0, ArraySize(g_szHumanModel2) - 1), szPlayerModel, charsmax(szPlayerModel))
				rg_set_user_model(id, szPlayerModel)
			}
			case 71..100:
			{
				ArrayGetString(g_szHumanModel3, random_num(0, ArraySize(g_szHumanModel3) - 1), szPlayerModel, charsmax(szPlayerModel))
				rg_set_user_model(id, szPlayerModel)
			}
			case 101..130:
			{
				ArrayGetString(g_szHumanModel4, random_num(0, ArraySize(g_szHumanModel4) - 1), szPlayerModel, charsmax(szPlayerModel))
				rg_set_user_model(id, szPlayerModel)
			}
		}
	}
}

public ze_user_infected(iVictim, iInfector)
{
	// Set Zombie Models
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
	
	// Player Admin?
	if(get_user_flags(iVictim) & ADMIN_MODELS_ACCESS)
	{
		// Set Zombie Admin Model
		ArrayGetString(g_szAdminZombieModel, random_num(0, ArraySize(g_szAdminZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
		rg_set_user_model(iVictim, szPlayerModel)
		
		// Set Admin Zombie Knife Model
		ArrayGetString(g_v_szAdminZombieKnifeModel, random_num(0, ArraySize(g_v_szAdminZombieKnifeModel) - 1), szModel, charsmax(szModel))
		cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
		cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
	}
}


and This one also Please


Code: Select all

#include <zombie_escape>

// Setting File
new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"

// Defines
#define MODEL_MAX_LENGTH 64
#define PLAYERMODEL_MAX_LENGTH 32
#define SOUND_MAX_LENGTH 64
#define TASK_AMBIENCESOUND 2020
#define TASK_REAMBIENCESOUND 5050

// Default Sounds
new const szReadySound[][] = 
{
	"zombie_escape/ze_ready.mp3"
}

new const szInfectSound[][] = 
{
	"zombie_escape/zombie_infect_1.wav",
	"zombie_escape/zombie_infect_2.wav"
}

new const szComingSound[][] = 
{
	"zombie_escape/zombie_coming_1.wav",
	"zombie_escape/zombie_coming_2.wav",
	"zombie_escape/zombie_coming_3.wav"
}

new const szPreReleaseSound[][] = 
{
	"zombie_escape/ze_pre_release.wav"
}

new const szAmbianceSound[][] = 
{
	"zombie_escape/ze_ambiance1.mp3",
	"zombie_escape/ze_ambiance2.mp3"
}

new const szEscapeSuccessSound[][] = 
{
	"zombie_escape/escape_success.wav"
}

new const szEscapeFailSound[][] = 
{
	"zombie_escape/escape_fail.wav"
}

// Default Sounds Duration (Hardcoded Values)
new g_iReadySoundDuration = 19
new g_iPreReleaseSoundDuration = 19
new g_iAmbianceSoundDuration = 160 //(Avarage for the 2 ambiances)


// Default Models
new const szHostZombieModel[][] =
{
	"host_zombie"
}

new const szOriginZombieModel[][] =
{
	"origin_zombie"
}

new const szHumanModels[][] = // These models not prechaced as it's default in cs
{
	"arctic",
	"gign",
	"gsg9",
	"guerilla",
	"leet",
	"sas",
	"terror",
	"urban"
}

new const v_szZombieKnifeModel[][] =
{
	"models/zombie_escape/v_knife_zombie.mdl"
}

new const v_szHumanKnifeModel[][] = 
{
	"models/v_knife.mdl"
}

new const p_szHumanKnifeModel[][] = 
{
	"models/p_knife.mdl"
} 

// Dynamic Arrays: Sounds
new Array:g_szReadySound, Array:g_szInfectSound, Array:g_szComingSound, Array:g_szPreReleaseSound,
Array:g_szAmbianceSound, Array:g_szEscapeSuccessSound, Array:g_szEscapeFailSound

// Dynamic Arrays: Models
new Array:g_szHostZombieModel, Array:g_szOriginZombieModel, Array:g_v_szZombieKnifeModel,
Array:g_v_szHumanKnifeModel, Array:g_p_szHumanKnifeModel 

public plugin_init()
{
	register_plugin("[ZE] Models & Sounds", ZE_VERSION, AUTHORS)
}

public plugin_precache()
{	
	// Initialize Arrays: Sounds
	g_szReadySound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szInfectSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szComingSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szPreReleaseSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szAmbianceSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szEscapeSuccessSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	g_szEscapeFailSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
	
	// Load From External File: Sounds
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
	
	// Load our Default Values: Sounds
	new iIndex
	
	if(ArraySize(g_szReadySound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szReadySound; iIndex++)
			ArrayPushString(g_szReadySound, szReadySound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
	}
	
	if(ArraySize(g_szInfectSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szInfectSound; iIndex++)
			ArrayPushString(g_szInfectSound, szInfectSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
	}
	
	if(ArraySize(g_szComingSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szComingSound; iIndex++)
			ArrayPushString(g_szComingSound, szComingSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
	}
	
	if(ArraySize(g_szPreReleaseSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szPreReleaseSound; iIndex++)
			ArrayPushString(g_szPreReleaseSound, szPreReleaseSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
	}
	
	if(ArraySize(g_szAmbianceSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szAmbianceSound; iIndex++)
			ArrayPushString(g_szAmbianceSound, szAmbianceSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
	}
	
	if(ArraySize(g_szEscapeSuccessSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szEscapeSuccessSound; iIndex++)
			ArrayPushString(g_szEscapeSuccessSound, szEscapeSuccessSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
	}
	
	if(ArraySize(g_szEscapeFailSound) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szEscapeFailSound; iIndex++)
			ArrayPushString(g_szEscapeFailSound, szEscapeFailSound[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
	}
	
	// Precache: Sounds
	new szSound[SOUND_MAX_LENGTH]
	
	for (iIndex = 0; iIndex < ArraySize(g_szReadySound); iIndex++)
	{
		ArrayGetString(g_szReadySound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szInfectSound); iIndex++)
	{
		ArrayGetString(g_szInfectSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szComingSound); iIndex++)
	{
		ArrayGetString(g_szComingSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szPreReleaseSound); iIndex++)
	{
		ArrayGetString(g_szPreReleaseSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szAmbianceSound); iIndex++)
	{
		ArrayGetString(g_szAmbianceSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szEscapeSuccessSound); iIndex++)
	{
		ArrayGetString(g_szEscapeSuccessSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szEscapeFailSound); iIndex++)
	{
		ArrayGetString(g_szEscapeFailSound, iIndex, szSound, charsmax(szSound))
		
		if (equal(szSound[strlen(szSound)-4], ".mp3"))
		{
			format(szSound, charsmax(szSound), "sound/%s", szSound)
			precache_generic(szSound)
		}
		else
		{
			precache_sound(szSound)
		}
	}
	
	// Sound Durations
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration)
	
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration)
	
	if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration))
		amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration)
	
	// Initialize Arrays: Models
	g_szHostZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_szOriginZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_v_szZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	g_v_szHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
	
	// Load From External File: Models
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
	amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN", g_p_szHumanKnifeModel)
	
	// Load our Default Values: Models
	if(ArraySize(g_szHostZombieModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szHostZombieModel; iIndex++)
			ArrayPushString(g_szHostZombieModel, szHostZombieModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
	}
	
	if(ArraySize(g_szOriginZombieModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof szOriginZombieModel; iIndex++)
			ArrayPushString(g_szOriginZombieModel, szOriginZombieModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
	}
	
	if(ArraySize(g_v_szZombieKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szZombieKnifeModel; iIndex++)
			ArrayPushString(g_v_szZombieKnifeModel, v_szZombieKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
	}
	
	if(ArraySize(g_v_szHumanKnifeModel) == 0)
	{
		for(iIndex = 0; iIndex < sizeof v_szHumanKnifeModel; iIndex++)
			ArrayPushString(g_v_szHumanKnifeModel, v_szHumanKnifeModel[iIndex])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
	}
	
	if(ArraySize(g_p_szHumanKnifeModel) == 0) 
	{
		for(iIndex = 0; iIndex < sizeof v_szHumanKnifeModel; iIndex++)
			ArrayPushString(g_p_szHumanKnifeModel, p_szHumanKnifeModel[iIndex]) 
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN", g_p_szHumanKnifeModel)
	} 
	
	// Precache: Models
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
	
	for (iIndex = 0; iIndex < ArraySize(g_szHostZombieModel); iIndex++)
	{
		ArrayGetString(g_szHostZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_szOriginZombieModel); iIndex++)
	{
		ArrayGetString(g_szOriginZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
		formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
		precache_model(szModelPath)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szZombieKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szZombieKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_v_szHumanKnifeModel); iIndex++)
	{
		ArrayGetString(g_v_szHumanKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	}
	
	for (iIndex = 0; iIndex < ArraySize(g_p_szHumanKnifeModel); iIndex++)
	{
		ArrayGetString(g_p_szHumanKnifeModel, iIndex, szModel, charsmax(szModel))
		precache_model(szModel)
	} 
}

// Play Ready sound only if game started
public ze_game_started()
{
	// Remove Tasks (Again as somehow may it not removed at the roundend)
	remove_task(TASK_AMBIENCESOUND)
	remove_task(TASK_REAMBIENCESOUND)
	
	// Stop All Sounds
	StopSound()
	
	// Play Ready Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szReadySound, random_num(0, ArraySize(g_szReadySound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_user_infected(iVictim, iInfector)
{	
	// Emit Sound For infection (Sound Source is The zombie Body)
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szInfectSound, random_num(0, ArraySize(g_szInfectSound) - 1), szSound, charsmax(szSound))
	emit_sound(iVictim, CHAN_BODY, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
	
	// Play Zombie Appear Sound for all Players
	ArrayGetString(g_szComingSound, random_num(0, ArraySize(g_szComingSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
	
	// Set Zombie Models
	new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
	
	// Random Model Set
	switch(random_num(0, 130))
	{
		case 0..30:
		{
			ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel) // This native Faster 100000000000 times than one in fun module
		}
		case 31..70:
		{
			ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
		case 71..100:
		{
			ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
		case 101..130:
		{
			ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
			rg_set_user_model(iVictim, szPlayerModel)
		}
	}
	
	ArrayGetString(g_v_szZombieKnifeModel, random_num(0, ArraySize(g_v_szZombieKnifeModel) - 1), szModel, charsmax(szModel))
	cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
	cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
}

public ze_zombie_appear()
{
	// Add Delay to let Infection Sound to complete
	set_task(3.0, "ZombieAppear", _, _, _, "a", 1)
}

public ZombieAppear()
{	
	// Play Pre-Release Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szPreReleaseSound, random_num(0, ArraySize(g_szPreReleaseSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_zombie_release()
{
	// Add Delay to make sure Pre-Release Sound Finished
	set_task(float((g_iPreReleaseSoundDuration) - (ze_get_release_time() - 3)), "AmbianceSound", TASK_AMBIENCESOUND, _, _, "a", 1)
}

public AmbianceSound()
{
	// Stop All Sounds
	StopSound()
	
	// Play The Ambiance Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
	
	// We should Set Task back again to replay (Repeated 5 times MAX)
	set_task(float(g_iAmbianceSoundDuration), "RePlayAmbianceSound", TASK_REAMBIENCESOUND, _, _, "a", 5)
}

public RePlayAmbianceSound()
{
	// Play The Ambiance Sound For All Players
	new szSound[SOUND_MAX_LENGTH]
	ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
	PlaySound(0, szSound)
}

public ze_user_humanized(id)
{
	if(ze_is_user_zombie(id) || !is_user_alive(id))
		return
	
	// Rest Player Model (Model Randomly)
	rg_set_user_model(id, szHumanModels[random_num(0, charsmax(szHumanModels))])
		
	// Rest Player view Knife model
	new szModel[MODEL_MAX_LENGTH]
	ArrayGetString(g_v_szHumanKnifeModel, random_num(0, ArraySize(g_v_szHumanKnifeModel) - 1), szModel, charsmax(szModel))
	cs_set_player_view_model(id, CSW_KNIFE, szModel)
	ArrayGetString(g_p_szHumanKnifeModel, random_num(0, ArraySize(g_p_szHumanKnifeModel) - 1), szModel, charsmax(szModel))
	cs_set_player_view_model(id, CSW_KNIFE, szModel) 
	
}

public ze_roundend(WinTeam)
{
	remove_task(TASK_AMBIENCESOUND)
	remove_task(TASK_REAMBIENCESOUND)
	StopSound()
	
	new szSound[SOUND_MAX_LENGTH]
	
	if (WinTeam == ZE_TEAM_ZOMBIE)
	{
		ArrayGetString(g_szEscapeFailSound, random_num(0, ArraySize(g_szEscapeFailSound) - 1), szSound, charsmax(szSound))
		PlaySound(0, szSound)
	}
	
	if (WinTeam == ZE_TEAM_HUMAN)
	{
		ArrayGetString(g_szEscapeSuccessSound, random_num(0, ArraySize(g_szEscapeSuccessSound) - 1), szSound, charsmax(szSound))
		PlaySound(0, szSound)
	}
}

Re: Help to add P_KNIFE_MODEL

Posted: 14 Mar 2017, 22:51
by Night Fury
  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  5.  
  6. // Defines
  7. #define MODEL_MAX_LENGTH 64
  8. #define PLAYERMODEL_MAX_LENGTH 32
  9. #define ACCESS_MAX_LENGTH 32
  10. #define ADMIN_MODELS_ACCESS ADMIN_LEVEL_H
  11.  
  12. // Default Models
  13. new const szAdminHumanModel[][] =
  14. {
  15.     "vip"
  16. }
  17.  
  18. new const szAdminZombieModel[][] =
  19. {
  20.     "zombie_admin"
  21. }
  22.  
  23. new const v_szAdminHumanKnifeModel[][] =
  24. {
  25.     "models/zombie_escape/v_knife_human_admin.mdl"
  26. }
  27.  
  28. new const p_szAdminHumanKnifeModel[][] =
  29. {
  30.     "models/zombie_escape/p_knife_human_admin.mdl"
  31. }
  32.  
  33. new const v_szAdminZombieKnifeModel[][] =
  34. {
  35.     "models/zombie_escape/v_knife_zombie_admin.mdl"
  36. }
  37.  
  38. new const szHumanModel1[][] =
  39. {
  40.     "human1"
  41. }
  42.  
  43. new const szHumanModel2[][] =
  44. {
  45.     "human2"
  46. }
  47.  
  48. new const szHumanModel3[][] =
  49. {
  50.     "human3"
  51. }
  52.  
  53. new const szHumanModel4[][] =
  54. {
  55.     "human4"
  56. }
  57.  
  58. // Dynamic Arrays: Models
  59. new Array:g_szAdminHumanModel, Array:g_szAdminZombieModel, Array:g_v_szAdminHumanKnifeModel, Array:g_p_szAdminHumanKnifeModel, Array:g_v_szAdminZombieKnifeModel,
  60. Array:g_szHumanModel1, Array:g_szHumanModel2, Array:g_szHumanModel3, Array:g_szHumanModel4
  61.  
  62. public plugin_init()
  63. {
  64.     register_plugin("[ZE] Special Models", ZE_VERSION, AUTHORS)
  65. }
  66.  
  67. public plugin_precache()
  68. {
  69.     // Initialize Arrays
  70.     g_szAdminHumanModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  71.     g_szAdminZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  72.     g_v_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  73.     g_p_szAdminHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  74.     g_v_szAdminZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  75.     g_szHumanModel1 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  76.     g_szHumanModel2 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  77.     g_szHumanModel3 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  78.     g_szHumanModel4 = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  79.    
  80.     // Load From External File
  81.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN ADMIN", g_szAdminHumanModel)
  82.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE ADMIN", g_szAdminZombieModel)
  83.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN ADMIN", g_v_szAdminHumanKnifeModel)
  84.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN ADMIN", g_p_szAdminHumanKnifeModel)
  85.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE ADMIN", g_v_szAdminZombieKnifeModel)
  86.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 1", g_szHumanModel1)
  87.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 2", g_szHumanModel2)
  88.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 3", g_szHumanModel3)
  89.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 4", g_szHumanModel4)
  90.    
  91.     // Load our Default Values
  92.     new iIndex
  93.    
  94.     if(ArraySize(g_szAdminHumanModel) == 0)
  95.     {
  96.         for(iIndex = 0; iIndex < sizeof szAdminHumanModel; iIndex++)
  97.             ArrayPushString(g_szAdminHumanModel, szAdminHumanModel[iIndex])
  98.        
  99.         // Save to external file
  100.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN ADMIN", g_szAdminHumanModel)
  101.     }
  102.    
  103.     if(ArraySize(g_szAdminZombieModel) == 0)
  104.     {
  105.         for(iIndex = 0; iIndex < sizeof szAdminZombieModel; iIndex++)
  106.             ArrayPushString(g_szAdminZombieModel, szAdminZombieModel[iIndex])
  107.        
  108.         // Save to external file
  109.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ZOMBIE ADMIN", g_szAdminZombieModel)
  110.     }
  111.    
  112.     if(ArraySize(g_v_szAdminHumanKnifeModel) == 0)
  113.     {
  114.         for(iIndex = 0; iIndex < sizeof v_szAdminHumanKnifeModel; iIndex++)
  115.             ArrayPushString(g_v_szAdminHumanKnifeModel, v_szAdminHumanKnifeModel[iIndex])
  116.        
  117.         // Save to external file
  118.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN ADMIN", g_v_szAdminHumanKnifeModel)
  119.     }
  120.    
  121.     if(ArraySize(g_p_szAdminHumanKnifeModel) == 0)
  122.     {
  123.         for(iIndex = 0; iIndex < sizeof p_szAdminHumanKnifeModel; iIndex++)
  124.             ArrayPushString(g_p_szAdminHumanKnifeModel, p_szAdminHumanKnifeModel[iIndex])
  125.        
  126.         // Save to external file
  127.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN ADMIN", g_p_szAdminHumanKnifeModel)
  128.     }
  129.    
  130.     if(ArraySize(g_v_szAdminZombieKnifeModel) == 0)
  131.     {
  132.         for(iIndex = 0; iIndex < sizeof v_szAdminZombieKnifeModel; iIndex++)
  133.             ArrayPushString(g_v_szAdminZombieKnifeModel, v_szAdminZombieKnifeModel[iIndex])
  134.        
  135.         // Save to external file
  136.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE ADMIN", g_v_szAdminZombieKnifeModel)
  137.     }
  138.    
  139.     if(ArraySize(g_szHumanModel1) == 0)
  140.     {
  141.         for(iIndex = 0; iIndex < sizeof szHumanModel1; iIndex++)
  142.             ArrayPushString(g_szHumanModel1, szHumanModel1[iIndex])
  143.        
  144.         // Save to external file
  145.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 1", g_szHumanModel1)
  146.     }
  147.    
  148.     if(ArraySize(g_szHumanModel2) == 0)
  149.     {
  150.         for(iIndex = 0; iIndex < sizeof szHumanModel2; iIndex++)
  151.             ArrayPushString(g_szHumanModel2, szHumanModel2[iIndex])
  152.        
  153.         // Save to external file
  154.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 2", g_szHumanModel2)
  155.     }
  156.    
  157.     if(ArraySize(g_szHumanModel3) == 0)
  158.     {
  159.         for(iIndex = 0; iIndex < sizeof szHumanModel3; iIndex++)
  160.             ArrayPushString(g_szHumanModel3, szHumanModel3[iIndex])
  161.        
  162.         // Save to external file
  163.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 3", g_szHumanModel3)
  164.     }
  165.    
  166.     if(ArraySize(g_szHumanModel4) == 0)
  167.     {
  168.         for(iIndex = 0; iIndex < sizeof szHumanModel4; iIndex++)
  169.             ArrayPushString(g_szHumanModel4, szHumanModel4[iIndex])
  170.        
  171.         // Save to external file
  172.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HUMAN 4", g_szHumanModel4)
  173.     }
  174.  
  175.     // Precache
  176.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
  177.    
  178.     for (iIndex = 0; iIndex < ArraySize(g_szAdminHumanModel); iIndex++)
  179.     {
  180.         ArrayGetString(g_szAdminHumanModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
  181.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  182.         precache_model(szModelPath)
  183.     }
  184.    
  185.     for (iIndex = 0; iIndex < ArraySize(g_szAdminZombieModel); iIndex++)
  186.     {
  187.         ArrayGetString(g_szAdminZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
  188.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  189.         precache_model(szModelPath)
  190.     }
  191.    
  192.     for (iIndex = 0; iIndex < ArraySize(g_szHumanModel1); iIndex++)
  193.     {
  194.         ArrayGetString(g_szHumanModel1, iIndex, szPlayerModel, charsmax(szPlayerModel))
  195.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  196.         precache_model(szModelPath)
  197.     }
  198.    
  199.     for (iIndex = 0; iIndex < ArraySize(g_szHumanModel2); iIndex++)
  200.     {
  201.         ArrayGetString(g_szHumanModel2, iIndex, szPlayerModel, charsmax(szPlayerModel))
  202.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  203.         precache_model(szModelPath)
  204.     }
  205.    
  206.     for (iIndex = 0; iIndex < ArraySize(g_szHumanModel3); iIndex++)
  207.     {
  208.         ArrayGetString(g_szHumanModel3, iIndex, szPlayerModel, charsmax(szPlayerModel))
  209.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  210.         precache_model(szModelPath)
  211.     }
  212.    
  213.     for (iIndex = 0; iIndex < ArraySize(g_szHumanModel4); iIndex++)
  214.     {
  215.         ArrayGetString(g_szHumanModel4, iIndex, szPlayerModel, charsmax(szPlayerModel))
  216.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  217.         precache_model(szModelPath)
  218.     }
  219.    
  220.     for (iIndex = 0; iIndex < ArraySize(g_v_szAdminHumanKnifeModel); iIndex++)
  221.     {
  222.         ArrayGetString(g_v_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
  223.         precache_model(szModel)
  224.     }
  225.    
  226.     for (iIndex = 0; iIndex < ArraySize(g_p_szAdminHumanKnifeModel); iIndex++)
  227.     {
  228.         ArrayGetString(g_p_szAdminHumanKnifeModel, iIndex, szModel, charsmax(szModel))
  229.         precache_model(szModel)
  230.     }
  231.    
  232.     for (iIndex = 0; iIndex < ArraySize(g_v_szAdminZombieKnifeModel); iIndex++)
  233.     {
  234.         ArrayGetString(g_v_szAdminZombieKnifeModel, iIndex, szModel, charsmax(szModel))
  235.         precache_model(szModel)
  236.     }
  237. }
  238.  
  239. public ze_user_humanized(id)
  240. {
  241.     if(ze_is_user_zombie(id) || !is_user_alive(id))
  242.         return
  243.        
  244.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
  245.  
  246.     // Player Admin?
  247.     if(get_user_flags(id) & ADMIN_MODELS_ACCESS)
  248.     {
  249.         // Set Admin Human Model
  250.         ArrayGetString(g_szAdminHumanModel, random_num(0, ArraySize(g_szAdminHumanModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  251.         rg_set_user_model(id, szPlayerModel)
  252.        
  253.         // Set Admin Human Knife Model
  254.         ArrayGetString(g_v_szAdminHumanKnifeModel, random_num(0, ArraySize(g_v_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
  255.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  256.         ArrayGetString(g_p_szAdminHumanKnifeModel, random_num(0, ArraySize(g_p_szAdminHumanKnifeModel) - 1), szModel, charsmax(szModel))
  257.         cs_set_player_weap_model(id, CSW_KNIFE, szModel)
  258.     }
  259.     else
  260.     {
  261.         // Rest Player Model (Model Randomly)
  262.         switch(random_num(0, 130))
  263.         {
  264.             case 0..30:
  265.             {
  266.                 ArrayGetString(g_szHumanModel1, random_num(0, ArraySize(g_szHumanModel1) - 1), szPlayerModel, charsmax(szPlayerModel))
  267.                 rg_set_user_model(id, szPlayerModel)
  268.             }
  269.             case 31..70:
  270.             {
  271.                 ArrayGetString(g_szHumanModel2, random_num(0, ArraySize(g_szHumanModel2) - 1), szPlayerModel, charsmax(szPlayerModel))
  272.                 rg_set_user_model(id, szPlayerModel)
  273.             }
  274.             case 71..100:
  275.             {
  276.                 ArrayGetString(g_szHumanModel3, random_num(0, ArraySize(g_szHumanModel3) - 1), szPlayerModel, charsmax(szPlayerModel))
  277.                 rg_set_user_model(id, szPlayerModel)
  278.             }
  279.             case 101..130:
  280.             {
  281.                 ArrayGetString(g_szHumanModel4, random_num(0, ArraySize(g_szHumanModel4) - 1), szPlayerModel, charsmax(szPlayerModel))
  282.                 rg_set_user_model(id, szPlayerModel)
  283.             }
  284.         }
  285.     }
  286. }
  287.  
  288. public ze_user_infected(iVictim, iInfector)
  289. {
  290.     // Set Zombie Models
  291.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
  292.    
  293.     // Player Admin?
  294.     if(get_user_flags(iVictim) & ADMIN_MODELS_ACCESS)
  295.     {
  296.         // Set Zombie Admin Model
  297.         ArrayGetString(g_szAdminZombieModel, random_num(0, ArraySize(g_szAdminZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  298.         rg_set_user_model(iVictim, szPlayerModel)
  299.        
  300.         // Set Admin Zombie Knife Model
  301.         ArrayGetString(g_v_szAdminZombieKnifeModel, random_num(0, ArraySize(g_v_szAdminZombieKnifeModel) - 1), szModel, charsmax(szModel))
  302.         cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
  303.         cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
  304.     }
  305. }

  1. #include <zombie_escape>
  2.  
  3. // Setting File
  4. new const ZE_SETTING_RESOURCES[] = "zombie_escape.ini"
  5.  
  6. // Defines
  7. #define MODEL_MAX_LENGTH 64
  8. #define PLAYERMODEL_MAX_LENGTH 32
  9. #define SOUND_MAX_LENGTH 64
  10. #define TASK_AMBIENCESOUND 2020
  11. #define TASK_REAMBIENCESOUND 5050
  12.  
  13. // Default Sounds
  14. new const szReadySound[][] =
  15. {
  16.     "zombie_escape/ze_ready.mp3"
  17. }
  18.  
  19. new const szInfectSound[][] =
  20. {
  21.     "zombie_escape/zombie_infect_1.wav",
  22.     "zombie_escape/zombie_infect_2.wav"
  23. }
  24.  
  25. new const szComingSound[][] =
  26. {
  27.     "zombie_escape/zombie_coming_1.wav",
  28.     "zombie_escape/zombie_coming_2.wav",
  29.     "zombie_escape/zombie_coming_3.wav"
  30. }
  31.  
  32. new const szPreReleaseSound[][] =
  33. {
  34.     "zombie_escape/ze_pre_release.wav"
  35. }
  36.  
  37. new const szAmbianceSound[][] =
  38. {
  39.     "zombie_escape/ze_ambiance1.mp3",
  40.     "zombie_escape/ze_ambiance2.mp3"
  41. }
  42.  
  43. new const szEscapeSuccessSound[][] =
  44. {
  45.     "zombie_escape/escape_success.wav"
  46. }
  47.  
  48. new const szEscapeFailSound[][] =
  49. {
  50.     "zombie_escape/escape_fail.wav"
  51. }
  52.  
  53. // Default Sounds Duration (Hardcoded Values)
  54. new g_iReadySoundDuration = 19
  55. new g_iPreReleaseSoundDuration = 19
  56. new g_iAmbianceSoundDuration = 160 //(Avarage for the 2 ambiances)
  57.  
  58.  
  59. // Default Models
  60. new const szHostZombieModel[][] =
  61. {
  62.     "host_zombie"
  63. }
  64.  
  65. new const szOriginZombieModel[][] =
  66. {
  67.     "origin_zombie"
  68. }
  69.  
  70. new const szHumanModels[][] = // These models not prechaced as it's default in cs
  71. {
  72.     "arctic",
  73.     "gign",
  74.     "gsg9",
  75.     "guerilla",
  76.     "leet",
  77.     "sas",
  78.     "terror",
  79.     "urban"
  80. }
  81.  
  82. new const v_szZombieKnifeModel[][] =
  83. {
  84.     "models/zombie_escape/v_knife_zombie.mdl"
  85. }
  86.  
  87. new const v_szHumanKnifeModel[][] =
  88. {
  89.     "models/v_knife.mdl"
  90. }
  91.  
  92. new const p_szHumanKnifeModel[][] =
  93. {
  94.     "models/p_knife.mdl"
  95. }
  96.  
  97. // Dynamic Arrays: Sounds
  98. new Array:g_szReadySound, Array:g_szInfectSound, Array:g_szComingSound, Array:g_szPreReleaseSound,
  99. Array:g_szAmbianceSound, Array:g_szEscapeSuccessSound, Array:g_szEscapeFailSound
  100.  
  101. // Dynamic Arrays: Models
  102. new Array:g_szHostZombieModel, Array:g_szOriginZombieModel, Array:g_v_szZombieKnifeModel,
  103. Array:g_v_szHumanKnifeModel, Array:g_p_szHumanKnifeModel
  104.  
  105. public plugin_init()
  106. {
  107.     register_plugin("[ZE] Models & Sounds", ZE_VERSION, AUTHORS)
  108. }
  109.  
  110. public plugin_precache()
  111. {  
  112.     // Initialize Arrays: Sounds
  113.     g_szReadySound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  114.     g_szInfectSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  115.     g_szComingSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  116.     g_szPreReleaseSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  117.     g_szAmbianceSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  118.     g_szEscapeSuccessSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  119.     g_szEscapeFailSound = ArrayCreate(SOUND_MAX_LENGTH, 1)
  120.    
  121.     // Load From External File: Sounds
  122.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
  123.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
  124.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
  125.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
  126.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
  127.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
  128.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
  129.    
  130.     // Load our Default Values: Sounds
  131.     new iIndex
  132.    
  133.     if(ArraySize(g_szReadySound) == 0)
  134.     {
  135.         for(iIndex = 0; iIndex < sizeof szReadySound; iIndex++)
  136.             ArrayPushString(g_szReadySound, szReadySound[iIndex])
  137.        
  138.         // Save to external file
  139.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Ready Sound", g_szReadySound)
  140.     }
  141.    
  142.     if(ArraySize(g_szInfectSound) == 0)
  143.     {
  144.         for(iIndex = 0; iIndex < sizeof szInfectSound; iIndex++)
  145.             ArrayPushString(g_szInfectSound, szInfectSound[iIndex])
  146.        
  147.         // Save to external file
  148.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Infect Sound", g_szInfectSound)
  149.     }
  150.    
  151.     if(ArraySize(g_szComingSound) == 0)
  152.     {
  153.         for(iIndex = 0; iIndex < sizeof szComingSound; iIndex++)
  154.             ArrayPushString(g_szComingSound, szComingSound[iIndex])
  155.        
  156.         // Save to external file
  157.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Coming Sound", g_szComingSound)
  158.     }
  159.    
  160.     if(ArraySize(g_szPreReleaseSound) == 0)
  161.     {
  162.         for(iIndex = 0; iIndex < sizeof szPreReleaseSound; iIndex++)
  163.             ArrayPushString(g_szPreReleaseSound, szPreReleaseSound[iIndex])
  164.        
  165.         // Save to external file
  166.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Pre-Release Sound", g_szPreReleaseSound)
  167.     }
  168.    
  169.     if(ArraySize(g_szAmbianceSound) == 0)
  170.     {
  171.         for(iIndex = 0; iIndex < sizeof szAmbianceSound; iIndex++)
  172.             ArrayPushString(g_szAmbianceSound, szAmbianceSound[iIndex])
  173.        
  174.         // Save to external file
  175.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Round Ambiance", g_szAmbianceSound)
  176.     }
  177.    
  178.     if(ArraySize(g_szEscapeSuccessSound) == 0)
  179.     {
  180.         for(iIndex = 0; iIndex < sizeof szEscapeSuccessSound; iIndex++)
  181.             ArrayPushString(g_szEscapeSuccessSound, szEscapeSuccessSound[iIndex])
  182.        
  183.         // Save to external file
  184.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Success", g_szEscapeSuccessSound)
  185.     }
  186.    
  187.     if(ArraySize(g_szEscapeFailSound) == 0)
  188.     {
  189.         for(iIndex = 0; iIndex < sizeof szEscapeFailSound; iIndex++)
  190.             ArrayPushString(g_szEscapeFailSound, szEscapeFailSound[iIndex])
  191.        
  192.         // Save to external file
  193.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Sounds", "Escape Fail", g_szEscapeFailSound)
  194.     }
  195.    
  196.     // Precache: Sounds
  197.     new szSound[SOUND_MAX_LENGTH]
  198.    
  199.     for (iIndex = 0; iIndex < ArraySize(g_szReadySound); iIndex++)
  200.     {
  201.         ArrayGetString(g_szReadySound, iIndex, szSound, charsmax(szSound))
  202.        
  203.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  204.         {
  205.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  206.             precache_generic(szSound)
  207.         }
  208.         else
  209.         {
  210.             precache_sound(szSound)
  211.         }
  212.     }
  213.    
  214.     for (iIndex = 0; iIndex < ArraySize(g_szInfectSound); iIndex++)
  215.     {
  216.         ArrayGetString(g_szInfectSound, iIndex, szSound, charsmax(szSound))
  217.        
  218.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  219.         {
  220.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  221.             precache_generic(szSound)
  222.         }
  223.         else
  224.         {
  225.             precache_sound(szSound)
  226.         }
  227.     }
  228.    
  229.     for (iIndex = 0; iIndex < ArraySize(g_szComingSound); iIndex++)
  230.     {
  231.         ArrayGetString(g_szComingSound, iIndex, szSound, charsmax(szSound))
  232.        
  233.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  234.         {
  235.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  236.             precache_generic(szSound)
  237.         }
  238.         else
  239.         {
  240.             precache_sound(szSound)
  241.         }
  242.     }
  243.    
  244.     for (iIndex = 0; iIndex < ArraySize(g_szPreReleaseSound); iIndex++)
  245.     {
  246.         ArrayGetString(g_szPreReleaseSound, iIndex, szSound, charsmax(szSound))
  247.        
  248.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  249.         {
  250.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  251.             precache_generic(szSound)
  252.         }
  253.         else
  254.         {
  255.             precache_sound(szSound)
  256.         }
  257.     }
  258.    
  259.     for (iIndex = 0; iIndex < ArraySize(g_szAmbianceSound); iIndex++)
  260.     {
  261.         ArrayGetString(g_szAmbianceSound, iIndex, szSound, charsmax(szSound))
  262.        
  263.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  264.         {
  265.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  266.             precache_generic(szSound)
  267.         }
  268.         else
  269.         {
  270.             precache_sound(szSound)
  271.         }
  272.     }
  273.    
  274.     for (iIndex = 0; iIndex < ArraySize(g_szEscapeSuccessSound); iIndex++)
  275.     {
  276.         ArrayGetString(g_szEscapeSuccessSound, iIndex, szSound, charsmax(szSound))
  277.        
  278.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  279.         {
  280.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  281.             precache_generic(szSound)
  282.         }
  283.         else
  284.         {
  285.             precache_sound(szSound)
  286.         }
  287.     }
  288.    
  289.     for (iIndex = 0; iIndex < ArraySize(g_szEscapeFailSound); iIndex++)
  290.     {
  291.         ArrayGetString(g_szEscapeFailSound, iIndex, szSound, charsmax(szSound))
  292.        
  293.         if (equal(szSound[strlen(szSound)-4], ".mp3"))
  294.         {
  295.             format(szSound, charsmax(szSound), "sound/%s", szSound)
  296.             precache_generic(szSound)
  297.         }
  298.         else
  299.         {
  300.             precache_sound(szSound)
  301.         }
  302.     }
  303.    
  304.     // Sound Durations
  305.     if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration))
  306.         amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Ready Sound", g_iReadySoundDuration)
  307.    
  308.     if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration))
  309.         amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Pre-Release Sound", g_iPreReleaseSoundDuration)
  310.    
  311.     if (!amx_load_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration))
  312.         amx_save_setting_int(ZE_SETTING_RESOURCES, "Sound Durations", "Round Ambiance", g_iAmbianceSoundDuration)
  313.    
  314.     // Initialize Arrays: Models
  315.     g_szHostZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  316.     g_szOriginZombieModel = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  317.     g_v_szZombieKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  318.     g_v_szHumanKnifeModel = ArrayCreate(MODEL_MAX_LENGTH, 1)
  319.    
  320.     // Load From External File: Models
  321.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
  322.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
  323.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
  324.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
  325.     amx_load_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN", g_p_szHumanKnifeModel)
  326.    
  327.     // Load our Default Values: Models
  328.     if(ArraySize(g_szHostZombieModel) == 0)
  329.     {
  330.         for(iIndex = 0; iIndex < sizeof szHostZombieModel; iIndex++)
  331.             ArrayPushString(g_szHostZombieModel, szHostZombieModel[iIndex])
  332.        
  333.         // Save to external file
  334.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "HOST ZOMBIE", g_szHostZombieModel)
  335.     }
  336.    
  337.     if(ArraySize(g_szOriginZombieModel) == 0)
  338.     {
  339.         for(iIndex = 0; iIndex < sizeof szOriginZombieModel; iIndex++)
  340.             ArrayPushString(g_szOriginZombieModel, szOriginZombieModel[iIndex])
  341.        
  342.         // Save to external file
  343.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Player Models", "ORIGIN ZOMBIE", g_szOriginZombieModel)
  344.     }
  345.    
  346.     if(ArraySize(g_v_szZombieKnifeModel) == 0)
  347.     {
  348.         for(iIndex = 0; iIndex < sizeof v_szZombieKnifeModel; iIndex++)
  349.             ArrayPushString(g_v_szZombieKnifeModel, v_szZombieKnifeModel[iIndex])
  350.        
  351.         // Save to external file
  352.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE ZOMBIE", g_v_szZombieKnifeModel)
  353.     }
  354.    
  355.     if(ArraySize(g_v_szHumanKnifeModel) == 0)
  356.     {
  357.         for(iIndex = 0; iIndex < sizeof v_szHumanKnifeModel; iIndex++)
  358.             ArrayPushString(g_v_szHumanKnifeModel, v_szHumanKnifeModel[iIndex])
  359.        
  360.         // Save to external file
  361.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "V_KNIFE HUMAN", g_v_szHumanKnifeModel)
  362.     }
  363.    
  364.     if(ArraySize(g_p_szHumanKnifeModel) == 0)
  365.     {
  366.         for(iIndex = 0; iIndex < sizeof p_szHumanKnifeModel; iIndex++)
  367.             ArrayPushString(g_p_szHumanKnifeModel, p_szHumanKnifeModel[iIndex])
  368.        
  369.         // Save to external file
  370.         amx_save_setting_string_arr(ZE_SETTING_RESOURCES, "Weapon Models", "P_KNIFE HUMAN", g_p_szHumanKnifeModel)
  371.     }
  372.    
  373.     // Precache: Models
  374.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH], szModelPath[128]
  375.    
  376.     for (iIndex = 0; iIndex < ArraySize(g_szHostZombieModel); iIndex++)
  377.     {
  378.         ArrayGetString(g_szHostZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
  379.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  380.         precache_model(szModelPath)
  381.     }
  382.    
  383.     for (iIndex = 0; iIndex < ArraySize(g_szOriginZombieModel); iIndex++)
  384.     {
  385.         ArrayGetString(g_szOriginZombieModel, iIndex, szPlayerModel, charsmax(szPlayerModel))
  386.         formatex(szModelPath, charsmax(szModelPath), "models/player/%s/%s.mdl", szPlayerModel, szPlayerModel)
  387.         precache_model(szModelPath)
  388.     }
  389.    
  390.     for (iIndex = 0; iIndex < ArraySize(g_v_szZombieKnifeModel); iIndex++)
  391.     {
  392.         ArrayGetString(g_v_szZombieKnifeModel, iIndex, szModel, charsmax(szModel))
  393.         precache_model(szModel)
  394.     }
  395.    
  396.     for (iIndex = 0; iIndex < ArraySize(g_v_szHumanKnifeModel); iIndex++)
  397.     {
  398.         ArrayGetString(g_v_szHumanKnifeModel, iIndex, szModel, charsmax(szModel))
  399.         precache_model(szModel)
  400.     }
  401.    
  402.     for (iIndex = 0; iIndex < ArraySize(g_p_szHumanKnifeModel); iIndex++)
  403.     {
  404.         ArrayGetString(g_p_szHumanKnifeModel, iIndex, szModel, charsmax(szModel))
  405.         precache_model(szModel)
  406.     }
  407. }
  408.  
  409. // Play Ready sound only if game started
  410. public ze_game_started()
  411. {
  412.     // Remove Tasks (Again as somehow may it not removed at the roundend)
  413.     remove_task(TASK_AMBIENCESOUND)
  414.     remove_task(TASK_REAMBIENCESOUND)
  415.    
  416.     // Stop All Sounds
  417.     StopSound()
  418.    
  419.     // Play Ready Sound For All Players
  420.     new szSound[SOUND_MAX_LENGTH]
  421.     ArrayGetString(g_szReadySound, random_num(0, ArraySize(g_szReadySound) - 1), szSound, charsmax(szSound))
  422.     PlaySound(0, szSound)
  423. }
  424.  
  425. public ze_user_infected(iVictim, iInfector)
  426. {  
  427.     // Emit Sound For infection (Sound Source is The zombie Body)
  428.     new szSound[SOUND_MAX_LENGTH]
  429.     ArrayGetString(g_szInfectSound, random_num(0, ArraySize(g_szInfectSound) - 1), szSound, charsmax(szSound))
  430.     emit_sound(iVictim, CHAN_BODY, szSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  431.    
  432.     // Play Zombie Appear Sound for all Players
  433.     ArrayGetString(g_szComingSound, random_num(0, ArraySize(g_szComingSound) - 1), szSound, charsmax(szSound))
  434.     PlaySound(0, szSound)
  435.    
  436.     // Set Zombie Models
  437.     new szPlayerModel[PLAYERMODEL_MAX_LENGTH], szModel[MODEL_MAX_LENGTH]
  438.    
  439.     // Random Model Set
  440.     switch(random_num(0, 130))
  441.     {
  442.         case 0..30:
  443.         {
  444.             ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  445.             rg_set_user_model(iVictim, szPlayerModel) // This native Faster 100000000000 times than one in fun module
  446.         }
  447.         case 31..70:
  448.         {
  449.             ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  450.             rg_set_user_model(iVictim, szPlayerModel)
  451.         }
  452.         case 71..100:
  453.         {
  454.             ArrayGetString(g_szHostZombieModel, random_num(0, ArraySize(g_szHostZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  455.             rg_set_user_model(iVictim, szPlayerModel)
  456.         }
  457.         case 101..130:
  458.         {
  459.             ArrayGetString(g_szOriginZombieModel, random_num(0, ArraySize(g_szOriginZombieModel) - 1), szPlayerModel, charsmax(szPlayerModel))
  460.             rg_set_user_model(iVictim, szPlayerModel)
  461.         }
  462.     }
  463.    
  464.     ArrayGetString(g_v_szZombieKnifeModel, random_num(0, ArraySize(g_v_szZombieKnifeModel) - 1), szModel, charsmax(szModel))
  465.     cs_set_player_view_model(iVictim, CSW_KNIFE, szModel)
  466.     cs_set_player_weap_model(iVictim, CSW_KNIFE, "") // Leave Blank so knife not appear with zombies
  467. }
  468.  
  469. public ze_zombie_appear()
  470. {
  471.     // Add Delay to let Infection Sound to complete
  472.     set_task(3.0, "ZombieAppear", _, _, _, "a", 1)
  473. }
  474.  
  475. public ZombieAppear()
  476. {  
  477.     // Play Pre-Release Sound For All Players
  478.     new szSound[SOUND_MAX_LENGTH]
  479.     ArrayGetString(g_szPreReleaseSound, random_num(0, ArraySize(g_szPreReleaseSound) - 1), szSound, charsmax(szSound))
  480.     PlaySound(0, szSound)
  481. }
  482.  
  483. public ze_zombie_release()
  484. {
  485.     // Add Delay to make sure Pre-Release Sound Finished
  486.     set_task(float((g_iPreReleaseSoundDuration) - (ze_get_release_time() - 3)), "AmbianceSound", TASK_AMBIENCESOUND, _, _, "a", 1)
  487. }
  488.  
  489. public AmbianceSound()
  490. {
  491.     // Stop All Sounds
  492.     StopSound()
  493.    
  494.     // Play The Ambiance Sound For All Players
  495.     new szSound[SOUND_MAX_LENGTH]
  496.     ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
  497.     PlaySound(0, szSound)
  498.    
  499.     // We should Set Task back again to replay (Repeated 5 times MAX)
  500.     set_task(float(g_iAmbianceSoundDuration), "RePlayAmbianceSound", TASK_REAMBIENCESOUND, _, _, "a", 5)
  501. }
  502.  
  503. public RePlayAmbianceSound()
  504. {
  505.     // Play The Ambiance Sound For All Players
  506.     new szSound[SOUND_MAX_LENGTH]
  507.     ArrayGetString(g_szAmbianceSound, random_num(0, ArraySize(g_szAmbianceSound) - 1), szSound, charsmax(szSound))
  508.     PlaySound(0, szSound)
  509. }
  510.  
  511. public ze_user_humanized(id)
  512. {
  513.     if(ze_is_user_zombie(id) || !is_user_alive(id))
  514.         return
  515.    
  516.     // Rest Player Model (Model Randomly)
  517.     rg_set_user_model(id, szHumanModels[random_num(0, charsmax(szHumanModels))])
  518.        
  519.     // Rest Player view Knife model
  520.     new szModel[MODEL_MAX_LENGTH]
  521.     ArrayGetString(g_v_szHumanKnifeModel, random_num(0, ArraySize(g_v_szHumanKnifeModel) - 1), szModel, charsmax(szModel))
  522.     cs_set_player_view_model(id, CSW_KNIFE, szModel)
  523.     ArrayGetString(g_p_szHumanKnifeModel, random_num(0, ArraySize(g_p_szHumanKnifeModel) - 1), szModel, charsmax(szModel))
  524.     cs_set_player_weap_model(id, CSW_KNIFE, szModel)
  525.    
  526. }
  527.  
  528. public ze_roundend(WinTeam)
  529. {
  530.     remove_task(TASK_AMBIENCESOUND)
  531.     remove_task(TASK_REAMBIENCESOUND)
  532.     StopSound()
  533.    
  534.     new szSound[SOUND_MAX_LENGTH]
  535.    
  536.     if (WinTeam == ZE_TEAM_ZOMBIE)
  537.     {
  538.         ArrayGetString(g_szEscapeFailSound, random_num(0, ArraySize(g_szEscapeFailSound) - 1), szSound, charsmax(szSound))
  539.         PlaySound(0, szSound)
  540.     }
  541.    
  542.     if (WinTeam == ZE_TEAM_HUMAN)
  543.     {
  544.         ArrayGetString(g_szEscapeSuccessSound, random_num(0, ArraySize(g_szEscapeSuccessSound) - 1), szSound, charsmax(szSound))
  545.         PlaySound(0, szSound)
  546.     }
  547. }