Raised This Month: $32 Target: $400
 8% 

Load Model Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZaKaRiAMaGh
Junior Member
Join Date: Apr 2020
Location: Morocco
Old 07-24-2020 , 14:11   Load Model Problem
Reply With Quote #1

hello guys
i need help , how to load a model djtable

i have a music menu Contains the following :
1.Music Menu (works)
2.Djtable [ON/OFF] (not working)
now i want when i m turning on this == load model
and when i m turning off == remove model
3.Stop Music (works)

when i open the cmd it doesnt work i dont know why
i was trying for week
i am so sorry about bad english language

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <fun>
#include <engine>
#include <xs>

#define PLUGIN "Menu Sounds"
#define VERSION "1.0"
#define AUTHOR "ReD [M]"
#define IsPlayer(%1)                    (1 <= %1 <= g_max_clients)

new smiya[64]
new const g_HBDJmdl[] = "models/HB-PrisonBreak/HBDJ.mdl"

new bool: dj_table = false

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_concmd("playermusic","PlayerMusic")
	register_clcmd("playermusic","PlayerMusic")
	register_clcmd("say /effect","PlayerMusic")
	
	register_clcmd("say /mzika", "ShowMusicMenu");
	
}
public PlayerMusic(id)
{
	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
         new menu = menu_create("\r[HB] \wMusic Menu [2]","MenuMusic")
         menu_additem(menu, "\wCoronaVirus Remix","1",0);
         menu_additem(menu, "\r69 GOOBA","2",0);
         menu_additem(menu, "\wBlack M [Frerot]","3",0);
         menu_additem(menu, "\rStromae [Alors On Danse]","4",0);
         menu_additem(menu, "\wSoolking [Melegim]","5",0);
         menu_additem(menu, "\rEdwardMaya [HAREM]","6",0);
	menu_additem(menu, "\wBabyshark Remix","7",0);
	menu_additem(menu, "\rMusic For Denis","8",0);
	menu_additem(menu, "\w","9",0);

         menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
         menu_display(id, menu, 0);
         return PLUGIN_HANDLED
	}
	else
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
	ColorChat(id,"^4[HB]^1You are a Prisonner");
	}
	return PLUGIN_HANDLED
}
public MenuMusic(id, menu, item)
{
	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
	new key = str_to_num(data);
	
	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
	switch(key)
	{
		case 1:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/1.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[CoronaRemix]",smiya);
		}
		case 2:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/2.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[GOOBA]",smiya);
		}
		case 3:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/3.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Frerot]",smiya);
		}
		case 4:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/4.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Alors On Danse]",smiya);
		}
		case 5:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/5.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Melegim]",smiya);
		}
		case 6:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/6.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[HAREM]",smiya);
		}
		case 7:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/7.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Babyshark]",smiya);
		}
		case 8:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/8.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Denis]",smiya);
		}
		case 9:
		{
		client_cmd( 0, "mp3 play ^"sound/HB-PrisonBreak/HB-Music2/9.mp3^"" );
		get_user_name(id,smiya,32)
		ColorChat(0,"^4[HB] ^1CT ^3[ %s ] ^1Playing Music ^4[Soon]",smiya);
		}
	   }
	  }
}
/*--------------------------------------------------------------------*/
public plugin_precache() 
{
  precache_sound("HB-PrisonBreak/HB-Music2/1.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/2.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/3.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/4.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/5.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/6.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/7.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/8.mp3")
  precache_sound("HB-PrisonBreak/HB-Music2/9.mp3")
  
  precache_model("models/HB-PrisonBreak/HBDJ.mdl")
  return PLUGIN_CONTINUE
}
/*--------------------------------------------------------------------*/
public ShowMusicMenu(id)
{
	new menu = menu_create("\rMusic Menu^n \yMenu By \rReD M ", "mh_gMenu");
	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
	menu_additem(menu, "\wMusic Menu\r", "", 0);
	new szText[555 char]
	formatex(szText , charsmax(szText) , "Dj Table [ %s \w]", dj_table? "\yON" : "\rOff")
	menu_additem(menu, szText , "1" , 0)
	menu_additem(menu, "\rStop Music \r^n", "", 0); 

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_setprop(menu, MPROP_BACKNAME, "Back");
	menu_setprop(menu, MPROP_NEXTNAME, "Next");
	menu_setprop(menu, MPROP_EXITNAME, "Exit");
	menu_setprop(menu, MPROP_NOCOLORS, 1);

	menu_display(id, menu, 0);
	}
	return PLUGIN_HANDLED;
}

public mh_gMenu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}
	new command[6], name[64], access, callback;
	menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
	switch(item)
	{
		case 0: client_cmd(id, "say /effect");
		case 1 :
		{
			if(dj_table = false)
			{
			new origin[3]
			pev( id, pev_origin, origin )
			new ent = engfunc( EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target" ) )
			entity_set_string(ent, EV_SZ_classname, "HBDJ")
			set_pev( ent, pev_origin, origin)
			engfunc( EngFunc_SetModel, ent, g_HBDJmdl )
			set_pev( ent, pev_framerate, 1.0)
			ColorChat( 0, "CT Deleted DJ Table" );
			}
			else if(dj_table != false)
			{
			new origin[3]
			pev( id, pev_origin, origin )
			new ent = engfunc( EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target" ) )
			entity_set_string(ent, EV_SZ_classname, "HBDJ")
			set_pev( ent, pev_origin, origin)
			engfunc( EngFunc_SetModel, ent, g_HBDJmdl )
			set_pev( ent, pev_framerate, 1.0)		
			}

		}
		case 2: client_cmd(id,"mp3 stop;stopsound")
	}

	menu_destroy(menu);

	return PLUGIN_HANDLED;
}

/*----------------------------------------- Chat Color ----------------------------------------------------------*/
	
stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
 
	replace_all(msg, 190, "!x04", "^4");
	replace_all(msg, 190, "!x01", "^1");
	replace_all(msg, 190, "!x03", "^3");
 
	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, get_user_msgid("SayText"), _, players[i]);
	write_byte(players[i]);
	write_string(msg);
	message_end();
	}
	}
	} 
}

Last edited by ZaKaRiAMaGh; 09-07-2020 at 13:12. Reason: solved
ZaKaRiAMaGh is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-24-2020 , 16:21   Re: Load Model Problem
Reply With Quote #2

In the mh_gMenu handler, you need to set the bool dj_table true or false when it's pressed, not to check its value, because you don't sets its vaules somewhere else.

Code:
new szText[555 char]     formatex(szText , charsmax(szText) , "Dj Table [ %s \w]", dj_table? "\yON" : "\rOff")
This is completely WRONG.
You need to format all menu items, even the menu itself:
Code:
new szText[555 char]; formatex(szText, charsmax(szText), "\rMusic Menu^n \yMenu By \rReD M "); new menu = menu_create(szText, "mh_gMenu"); formatex(szText, charsmax(szText), "\wMusic Menu\r"); menu_additem(menu, szText, "0"); formatex(szText , charsmax(szText) , "Dj Table [ %s \w]", dj_table? "\yON" : "\rOff"); menu_additem(menu, szText , "1") formatex(szText , charsmax(szText), "\rStop Music \r^n"); menu_additem(menu, szText, "2");
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 07-24-2020 at 16:22.
Shadows Adi is offline
ZaKaRiAMaGh
Junior Member
Join Date: Apr 2020
Location: Morocco
Old 07-25-2020 , 04:28   Re: Load Model Problem
Reply With Quote #3

Quote:
Originally Posted by Shadows Adi View Post
In the mh_gMenu handler, you need to set the bool dj_table true or false when it's pressed, not to check its value, because you don't sets its vaules somewhere else.
i want the code how to put the model and how the remove it
ZaKaRiAMaGh is offline
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 07-25-2020 , 04:41   Re: Load Model Problem
Reply With Quote #4

He told you what to do -> You have to change the value of dj_table boolean variable since you don't do that anywhere.
When you do that THEN ask for more help if it's not working.
Foxa is offline
Reply


Thread Tools
Display Modes

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 19:33.


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