Raised This Month: $12 Target: $400
 3% 

entity reset


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-23-2020 , 19:12   entity reset
Reply With Quote #1

hi guys. i m new in scripting so i don t know how to do some stuff.

so i want to make a menu that enable/disable a hat. i tried this, but the 2 skin are overlapping

Code:
public hatent(const id) 
{
if (!(get_user_flags(id) & VIP_FLAG)) return 0;
new CsTeams:iTeam = cs_get_user_team(id)
new iEntity = g_iHats[id]  = create_entity("info_target")


if (is_valid_ent(iEntity)){
	switch(checkHS1){
		case false:{
			set_pev(g_iHats[id], pev_effects, pev(g_iHats[id], pev_effects) | EF_NODRAW)
		}
		case true:{
			set_pev(g_iHats[id], pev_effects, pev(g_iHats[id], pev_effects) & ~EF_NODRAW) 
		}
	}
	entity_set_model (iEntity, g_szHatModel[iTeam])
	entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
	entity_set_edict( iEntity, EV_ENT_aiment, id );
	
}

}
lexzor is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-23-2020 , 23:23   Re: entity reset
Reply With Quote #2

So what exactly are you needing help with? Are you starting with a hat plugin that is working already?
__________________
fysiks is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-23-2020 , 23:28   Re: entity reset
Reply With Quote #3



I'm trying to make this menu :
lexzor is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-23-2020 , 23:30   Re: entity reset
Reply With Quote #4

Ok. There is a tutorial for creating menus here.
__________________
fysiks is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-23-2020 , 23:41   Re: entity reset
Reply With Quote #5

it's a misunderstanding. i want to make a menu from where u can disable/enable an entity. in this case, is a christmas hat. this christmas hat is assigned for both teams. like

PHP Code:
new const g_szHatModel[CsTeams][] = 
{
"",
"models/t_santa.mdl",
"models/ct_santa.mdl",
""

and i want to put them like this
PHP Code:
new CsTeams:iTeam cs_get_user_team(id)
entity_set_model(iEntityg_szHatModel[iTeams]) 
i already make them appear on player head, but i can t make them dissapear and if i'm at ct and i press 1 when i'm in above menu and then change team and do same thing, the entitys overlapping.

Last edited by lexzor; 11-23-2020 at 23:41.
lexzor is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-24-2020 , 00:49   Re: entity reset
Reply With Quote #6

Have you looked at the existing hat plugin to see how it's done in there? I would never use a plugin like this so I am not familiar with it specifically.

Having more than one topic (the menu and the removing of the hat) in a single thread is confusing. You should create one thread for each distinct issue. So, try to implement the menu on your own based on the tutorial and if you have issues, create a thread for that issue and post your attempt (preferably the whole plugin, it's much easier to help you if you post the whole plugin).
__________________
fysiks is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-24-2020 , 01:30   Re: entity reset
Reply With Quote #7

I already created the menu.
lexzor is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-24-2020 , 02:24   Re: entity reset
Reply With Quote #8

ok, i figured out how to do this, but my server crash when i'm spawning. Solutions ?

i used registerham player spawn for public hatent

PHP Code:
public hatent(const id
{
    
    if (!(
get_user_flags(id) & VIP_FLAG)) return 0;
    
    new 
CsTeams:iTeam get_user_team(id)
    
    if(!(
is_valid_ent(iEntity)))
        
iEntity g_iHats[id]  = create_entity("info_target")
    
    if (
is_valid_ent(iEntity)){
        if(
checkHS1){
            if(
checkHS2){
                
entity_set_model (iEntityg_szHatModel[CS_TEAM_CT])
            }
            else {
                
entity_set_model (iEntityg_szHatModel[CS_TEAM_T])
            }
        }
    }
    if (
is_valid_ent(iEntity)){
        switch(
checkHS1){
            case 
false:{
                
set_pev(g_iHats[id], pev_effectspev(g_iHats[id], pev_effects) | EF_NODRAW)
            }
            case 
true:{
                
set_pev(g_iHats[id], pev_effectspev(g_iHats[id], pev_effects) & ~EF_NODRAW
            }
        }
    }
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FOLLOW );
    
entity_set_edictiEntityEV_ENT_aimentid );
    if(!
checkHS1remove_entity(iEntity)


Last edited by lexzor; 11-24-2020 at 02:29.
lexzor is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 11-24-2020 , 20:08   Re: entity reset
Reply With Quote #9

i figured out how to solve. Thanks for suggestions!
lexzor 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 07:04.


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