Raised This Month: $ Target: $400
 0% 

Please help with zp_select_models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Firuz
Member
Join Date: Dec 2014
Location: Tajikistan
Old 07-21-2015 , 16:55   Please help with zp_select_models
Reply With Quote #1

Hi all please help me this plugin
I want my models save next round.
Example: I chose model from zp_select_models this save next round.
Thank advance.

Code:
#include <amxmodx>
#include <cstrike>
#include <zombie_plague_advance>
#include <fakemeta>
#include <fun>

new g_ent_playermodel[33];
new g_ent_weaponmodel[33];
new g_currentweapon[33];
new g_pcvar_active;
new SayText;

new const Model1[] = "HG-Crysis" 
new const Model2[] = "HG-Wesker" 
new const Model3[] = "HG-Santa" 
new const Model4[] = "HG-Miku" 
new const Model5[] = "HG-Cat" 
new const Model6[] = "HG-Cloud" 
new const Model7[] = "HG-Haha" 

new MenuKeys = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5) + (1 << 6) + (1 << 7) + (1 << 8)+ (1 << 9)
new BuyMenuBodyText[256]

public plugin_init()
{
	register_plugin("[ZP] Select Models [VIP]", "1.2", "Anggara_nothing")
	g_pcvar_active = register_cvar("zp_sem_enable", "1")
	register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
	SetupSelectMenu()
	register_clcmd("say /vmodels", "ClCmdSelectModel")
	register_clcmd("vmodels", "ClCmdSelectModel")
	register_menucmd(register_menuid("\rВыберите свою модель:"), MenuKeys, "SelectIt")
        SayText = get_user_msgid("SayText")
}

public plugin_precache()
{
	precache_player_model(Model1) 
	precache_player_model(Model2)
	precache_player_model(Model3)
	precache_player_model(Model4)
	precache_player_model(Model5)
	precache_player_model(Model6)
	precache_player_model(Model7)      
}

// Current Weapon info
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
	// Player not alive or not an active weapon
	if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
		return;
	
	// Get weapon id
	static weapon
	weapon = get_msg_arg_int(2)
	
	// Store weapon id for reference
	g_currentweapon[msg_entity] = weapon
	
	// Replace weapon models with custom ones
	fm_set_weaponmodel_ent(msg_entity)
}
// User Infected forward
public zp_user_infected_post(id, infector)
{
	// remove the glow.
	set_user_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
	
	// Remove Custom Model Entities
	fm_remove_model_ents(id)
}

public ClCmdSelectModel(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
	if(zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
	{
		Color_chat(id, "^4[ZP] ^1Выбор модели только для ^4людей!");

		set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
		show_hudmessage(id, "Только для людей!")
		return PLUGIN_HANDLED;
	}
	else if(!get_pcvar_num(g_pcvar_active))
	{
		set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
		show_hudmessage(id, "Возможность выбора отключена.")
		return PLUGIN_HANDLED;
	}
	else if(!is_user_alive(id))
	{
		Color_chat(id, "^4[ZP] ^1Мертвые не могут выбрать модель!");

		set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
		show_hudmessage(id, "Мертвые не могут выбрать модель!")
		return PLUGIN_HANDLED;
	}
	else
	{
		SetupSelectMenu()
		show_menu(id, MenuKeys, BuyMenuBodyText)
	}
	return PLUGIN_CONTINUE;
}
else  Color_chat(id, "^4[ZP] ^1Эти модели только для ^4VIP!") 
return PLUGIN_CONTINUE;
}

public SelectIt(id, key)
{
	switch (key)
	{
		case 0:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model1)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 1:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model2)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 2:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model3)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 3:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model4)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 4:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model5)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 5:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model6)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 6:
		{
			fm_remove_model_ents(id)
			if (!pev_valid(g_ent_playermodel[id]))
			{
				g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
				if (!pev_valid(g_ent_playermodel[id])) return ;
				
				set_pev(g_ent_playermodel[id], pev_classname, "player_model")
				set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
				set_pev(g_ent_playermodel[id], pev_aiment, id)
				set_pev(g_ent_playermodel[id], pev_owner, id)
				// and change this.
				zp_override_user_model(id, Model7)
				fm_set_weaponmodel_ent(id)
			}
		}
		case 9: return ;
	}
	
	ClCmdSelectModel(id)
	return;
}

public SetupSelectMenu()
{
	new menuLen = format(BuyMenuBodyText, 255, "\yВыберите свою модель:^n\dNewLifeZM: 178.248.81.36:27015^n^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w1. Crysis^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w2. Wesker^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w3. Santa^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w4. Miku^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w5. Cat^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w6. Cloud^n")
	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\y[ZM] \w7. Haha^n^n")

	menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w0. Exit")

	return 1
}

// Remove Custom Model Entities
stock fm_remove_model_ents(id)
{
	// Remove "playermodel" ent if present
	if (pev_valid(g_ent_playermodel[id]))
	{
		engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id])
		g_ent_playermodel[id] = 0
	}
	// Remove "weaponmodel" ent if present
	if (pev_valid(g_ent_weaponmodel[id]))
	{
		engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id])
		g_ent_weaponmodel[id] = 0
	}
}

// Set Weapon Model on Entity
stock fm_set_weaponmodel_ent(id)
{
	// Get player's p_ weapon model
	static model[100]
	pev(id, pev_weaponmodel2, model, sizeof model - 1)
	
	// Set model on entity or make a new one if unexistant
	if (!pev_valid(g_ent_weaponmodel[id]))
	{
		g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
		if (!pev_valid(g_ent_weaponmodel[id])) return;
		
		set_pev(g_ent_weaponmodel[id], pev_classname, "weapon_model")
		set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW)
		set_pev(g_ent_weaponmodel[id], pev_aiment, id)
		set_pev(g_ent_weaponmodel[id], pev_owner, id)
	}
	
	engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model)
}

stock Color_chat(const id, const input[], any:...) 
{ 
    new count = 1, players[32]; 
    static msg[191]; 
    vformat(msg, 190, input, 3); 
    replace_all(msg, 190, "!g", "^4"); // Green Color 
    replace_all(msg, 190, "!y", "^1"); // Default Color 
    replace_all(msg, 190, "!t", "^3"); // Team Color 
    if (id) players[0] = id; else get_players(players, count, "ch"); 
    { 
        for ( new i = 0; i < count; i++ ) 
        { 
            if ( is_user_connected(players[i]) ) 
            { 
                message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]); 
                write_byte(players[i]); 
                write_string(msg); 
                message_end(); 
            } 
        } 
    } 
}
precache_player_model(const modelname[]) 
{   
    static longname[128] 
    formatex(longname, charsmax(longname), "models/player/%s/%s.mdl", modelname, modelname)  
    precache_model(longname) 
     
    copy(longname[strlen(longname)-4], charsmax(longname) - (strlen(longname)-4), "T.mdl") 
    if (file_exists(longname)) precache_model(longname) 
}

Last edited by Firuz; 07-21-2015 at 16:56.
Firuz is offline
Reply



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 13:50.


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