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

Solved Problem with entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 10-28-2021 , 15:08   Problem with entity
Reply With Quote #1

When I spawn it shutdowns the server.

PHP Code:
CreateCal(const Float:vOrigin[3]){
    new 
iEntity create_entity("ambient_generic");
    if(!
iEntity){
        return 
0;
    }
    
set_pev(iEntitypev_messageSOUND_CAL);
    
set_pev(iEntitypev_spawnflagsRADIO_SOUND);
    
//set_pev( iEntity, pev_effects, EF_BRIGHTFIELD);
    
set_pev(iEntitypev_health10.0);
    
DispatchSpawn(iEntity); 
    
entity_set_string(iEntityEV_SZ_classname"env_cal");
    
entity_set_int(iEntityEV_INT_solidSOLID_NOT);
    
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_NONE);
    
entity_set_size(iEntityFloat:{ -1.0, -1.0, -1.0 }, Float:{ 1.01.036.0 });
    
entity_set_origin(iEntityvOrigin);
    
entity_set_model(iEntityMODEL_CAL);
    
drop_to_floor(iEntity);
    
    return 
iEntity;

The sound is in the route and is .wav, also the model. The radio sound is defined to 2.
PHP Code:
new Float:vOrigin[3];
entity_get_vector(idEV_VEC_originvOrigin);
CreateCal(vOrigin); 

Last edited by The overrated maniac; 10-31-2021 at 03:17. Reason: Solved
The overrated maniac is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 10-28-2021 , 22:06   Re: Problem with entity
Reply With Quote #2

have you try to comment each line to see which cause the crash?
__________________
My plugin:
Celena Luna is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-29-2021 , 01:11   Re: Problem with entity
Reply With Quote #3

Assuming the model?
Those type of entities can have models unless i am wrong.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-29-2021 at 01:11.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-29-2021 , 10:12   Re: Problem with entity
Reply With Quote #4

Precache is required. Where is it?

There are valid parameters for ambient_generic.

PHP Code:
 classname ambient_generic
ambient_generic origin 
-1976 -179 -3618
ambient_generic angles 0 0 0
ambient_generic targetname wav_wrong
ambient_generic message misc
/machine_off.wav
ambient_generic health 10
ambient_generic preset 0
ambient_generic volstart 0
ambient_generic fadein 0
ambient_generic fadeout 0
ambient_generic pitch 100
ambient_generic pitchstart 100
ambient_generic spinup 0
ambient_generic spindown 0
ambient_generic lfotype 0
ambient_generic lforate 0
ambient_generic lfomodpitch 0
ambient_generic lfomodvol 0
ambient_generic cspinup 0
ambient_generic spawnflags 36 
Get it working the stock way first then complicate later.
__________________

Last edited by DJEarthQuake; 10-29-2021 at 13:11. Reason: Posted in mid-sentence :)
DJEarthQuake is offline
Old 10-30-2021, 19:03
The overrated maniac
This message has been deleted by The overrated maniac.
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 10-30-2021 , 19:06   Re: Problem with entity
Reply With Quote #5

Thanks for the answer, the problem is the model, how can I add it right?

PHP Code:
new const MODEL_CAL[] = "models/cal.mdl";
new 
bool:bCal;

public 
plugin_init(){
    
register_plugin"Tree Spawner""1.0""xPaw" );

    
bCal =     true;
}

public 
plugin_precache(){
    if(
bCal){
        
precache_model(MODEL_CAL);
    }
}

then just the code posted before 
Tree Spawner by xPaw use ambient_generic and a tree model. Why I can't?

Last edited by The overrated maniac; 10-30-2021 at 19:07.
The overrated maniac is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-30-2021 , 20:50   Re: Problem with entity
Reply With Quote #6

Liable to be a precache issue. Post all the code.
__________________
DJEarthQuake is offline
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 10-30-2021 , 23:15   Re: Problem with entity
Reply With Quote #7

Quote:
Originally Posted by DJEarthQuake View Post
Liable to be a precache issue. Post all the code.
Thats all the code that is needed. The model is in the route and with the right name.

Also there is the precache from the model.. when the plugins starts it sets the boolean variable on true, then the precache ask if the variable is true and if it is, then precache the model.

Can the problem be that the precache is exed before plugin init? I dont know who starts first.

Last edited by The overrated maniac; 10-30-2021 at 23:16.
The overrated maniac is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-30-2021 , 23:40   Re: Problem with entity
Reply With Quote #8

Ambient is a sound. Precache the sound. That bool is needless how it is shown. It will always be true.
__________________
DJEarthQuake is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-30-2021 , 23:41   Re: Problem with entity
Reply With Quote #9

Yeah plugin_precache is executed first, you might want to remove the variable bCal
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 10-31-2021 , 03:16   Re: Problem with entity
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
Yeah plugin_precache is executed first, you might want to remove the variable bCal
Thanks
The overrated maniac 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 21:37.


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