If you ever played a bhop map, you'll know what I'm trying to do in this plugin. Basically trying to make a func_door, when you touch it it goes down into the ground (the keyvalues I have are correct).
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "bhop box maker"
#define VERSION "0.1"
#define AUTHOR "FatalisDK"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /bhopbox","bhop")
//register_clcmd("finddoor","doorfind")
}
/*public doorfind(id)
{
new door = find_ent_by_class(-1,"func_door")
client_print(0,print_chat,"Movetype - %i",entity_get_int(door,EV_INT_movetype))
client_print(0,print_chat,"Solid - %i",entity_get_int(door,EV_INT_solid))
}*/
public bhop(id)
{
new ent = create_entity("info_target")
if (!is_valid_ent(ent)) return PLUGIN_HANDLED
DispatchKeyValue(ent,"classname","func_door")
DispatchKeyValue(ent,"rendercolor","0 0 0")
DispatchKeyValue(ent,"angles","90 0 0")
DispatchKeyValue(ent,"speed","100")
DispatchKeyValue(ent,"wait","1")
DispatchSpawn(ent)
entity_set_string(ent,EV_SZ_classname,"func_door")
entity_set_model(ent,"models/bhopbox.mdl")
entity_set_size(ent,Float:{-32.0,-32.0,-32.0},Float:{32.0,32.0,32.0})
entity_set_int(ent,EV_INT_solid,SOLID_BSP) //finddoor returned 4 (SOLID_BSP)
entity_set_int(ent,EV_INT_movetype,MOVETYPE_PUSH) //finddoor returned 7 (MOVETYPE_PUSH)
new origin[3]
get_user_origin(id,origin)
new Float:flOrigin[3]
IVecFVec(origin,flOrigin)
entity_set_origin(ent,flOrigin)
flOrigin[2] += 72.0
entity_set_origin(id,flOrigin)
return PLUGIN_HANDLED
}
public plugin_precache()
{
precache_model("models/bhopbox.mdl")
}