AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with entities (solid and size) (https://forums.alliedmods.net/showthread.php?t=90250)

zacky 04-15-2009 17:18

Need help with entities (solid and size)
 
I wanted to get to know how to create entities, and i know how to do it now, but, i can walk through it and i dont know how to fix this, i've even setted size and made is to SOLID_BBOX, but it still doesnt work, please help me.

Heres the code:
Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
new const gszModel[] = "models/blockmaker/bm_block_bhop.mdl";
new const gClassname[] = "info_target";
 
public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 register_clcmd("say /cc", "cmdCreateCar")
}
 
public plugin_precache()
 precache_model(gszModel); 
 
public cmdCreateCar(id) {
 if (get_user_flags(id) & ADMIN_CHAT)
 {
  new origin[3];
  new Float:FLorigin[3];
  new Float: vAngles[] = {0.0, 0.0, 0.0};
 
  get_user_origin(id, origin, 2);
 
  FLorigin[ 0 ] = float( origin[0] );
  FLorigin[ 1 ] = float( origin[1] );
  FLorigin[ 2 ] = float( origin[2] );
 
  cmdCreateCar2(FLorigin, vAngles);
 }
}
 
cmdCreateCar2(Float:FLorigin[3], Float:vAngles[3]) {
 new ent = create_entity(gClassname);
 
 new Float:gSizeMin[] = {-32.0, -32.0, -4.0};
 new Float:gSizeMax[] = {32.0, 32.0, 4.0};
 
 if (is_valid_ent(ent)) {
  entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  entity_set_vector(ent, EV_VEC_angles, vAngles);
  entity_set_origin(ent, FLorigin);
  entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  entity_set_size(ent, gSizeMin, gSizeMax);
  entity_set_model(ent, gszModel);
 
  return ent;
 }
 return 0;
}

And if you wanna know why i use cmdCreateCar is because i was doing with car first, but it didnt work with size and solid either, so i made it to bhop block (from blockmaker) because i checked the size on them in bm, which then didn't work either.

+karma for help

xPaw 04-16-2009 01:17

Re: Need help with entities (solid and size)
 
you setted it to be solid, and did size box, its just smaller than your model, you need bigger size to make as you want, make the entity solid, and you will see what solid box is smaller than view model.. hope you got my point

Hunter-Digital 04-16-2009 06:12

Re: Need help with entities (solid and size)
 
spawn it...

PHP Code:

cmdCreateCar2(Float:FLorigin[3], Float:vAngles[3])
{
 new 
ent create_entity(gClassname);
 
 new 
Float:gSizeMin[] = {-32.0, -32.0, -4.0};
 new 
Float:gSizeMax[] = {32.032.04.0};
 
 if (
is_valid_ent(ent))
  return 
0;

 
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE)
 
entity_set_vector(entEV_VEC_anglesvAngles)
 
entity_set_origin(entFLorigin)
 
DispatchSpawn(ent)
 
entity_set_model(entgszModel)
 
entity_set_int(entEV_INT_solidSOLID_BBOX)
 
entity_set_size(entgSizeMingSizeMax)

 return 
ent;



xPaw 04-16-2009 07:11

Re: Need help with entities (solid and size)
 
Those returns was unneded, also you are sending angles to cmdCreateCar2, but they will be always 0.0 0.0 0.0, because you arent getting them from player, or what eever you want.

PHP Code:

#include <amxmodx>
#include <engine>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const gszModel[] = "models/blockmaker/bm_block_bhop.mdl";
new const 
gClassname[] = "info_target";

public 
plugin_init() {
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd("say /cc""cmdCreateCar");
}

public 
plugin_precache()
    
precache_modelgszModel );
 
public 
cmdCreateCarid ) {
    if( 
get_user_flags(id) & ADMIN_CHAT ) {
        new 
origin[3], Float:FLorigin[3], Float:vAngles[3];
        
get_user_originidorigin);
        
        
FLorigin] = floatorigin[0] );
        
FLorigin] = floatorigin[1] );
        
FLorigin] = floatorigin[2] );
        
        
cmdCreateCar2(FLoriginvAngles);
    }
}
 
cmdCreateCar2Float:FLorigin[3], Float:vAngles[3] ) {
    new 
ent create_entitygClassname );
 
    if( 
is_valid_entent ) ) {
        new 
Float:gSizeMin[] = {-32.0, -32.0, -4.0};
        new 
Float:gSizeMax[] = {32.032.04.0};
        
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE);
        
entity_set_vector(entEV_VEC_anglesvAngles);
        
entity_set_origin(entFLorigin);
        
        
DispatchSpawn(ent);
        
        
entity_set_model(entgszModel);
        
entity_set_int(entEV_INT_solidSOLID_BBOX);
        
entity_set_size(entgSizeMingSizeMax);
    }



zacky 04-16-2009 16:45

Re: Need help with entities (solid and size)
 
Thanks xPaw, +karma


All times are GMT -4. The time now is 02:16.

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