OK, plugin is complete, only 1 problem..
My plugin is a port of AssKicR's "Admin Wall" plugin, but I wanted to add feature and fix things. The major problem with his plugin was collision, well, i've almost fixed that problem.
As of now, you place a wall and 2 seconds later it makes it solid (so you can't move through it) and it works fine, but only at 1 angle. It's like the hitbox for the entity doesn't know where the entity really is or something.. I don't know, here's the code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
new wallEnts[9999]
new wallCount = 0
new g_theID
new g_theWall
public plugin_init() {
register_plugin("AMX Wall Maker", "1.11", "whitemike & AssKicR")
register_clcmd("amx_wall_create", "wallCreate", ADMIN_SLAY)
register_clcmd("amx_wall_clear", "wallClear", ADMIN_SLAY)
return PLUGIN_CONTINUE
}
public plugin_precache() {
precache_model("models/wall.mdl")
return PLUGIN_CONTINUE
}
public wallClear(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
new i = 0
for(i=1; i<=wallCount; i++) {
remove_entity(wallEnts[i])
wallEnts[i] = false
}
client_print(id, print_chat, "[AMXX][WALL MAKER] %i Wall(s) removed.", i-1)
wallCount = 0
return PLUGIN_HANDLED
}
public wallCreate(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED
if (!is_user_alive(id)) {
client_print(id, print_chat, "[AMXX][WALL MAKER] Couldn't make wall! Reason: You are dead")
return PLUGIN_HANDLED
}
else {
if(g_theWall != 0) {
client_print(id, print_chat, "[AMXX][WALL MAKER] Couldn't make the wall! Reason: Too many in queue")
return PLUGIN_HANDLED
}
wallCount = wallCount + 1
new tmpWall
tmpWall = create_entity("info_target")
entity_set_string(tmpWall, EV_SZ_classname, "AMX_Wall_Placer")
entity_set_model(tmpWall, "models/wall.mdl")
//entity_set_float(tmpWall, EV_FL_health, 10000.0)
//entity_set_int(tmpWall, EV_INT_solid, 1)
new Float:MinBox[3]
new Float:MaxBox[3]
MinBox[0] = -10.0
MinBox[1] = -85.0
MinBox[2] = -125.0
MaxBox[0] = 10.0
MaxBox[1] = 85.0
MaxBox[2] = 125.0
entity_set_vector(tmpWall, EV_VEC_mins, MinBox)
entity_set_vector(tmpWall, EV_VEC_maxs, MaxBox)
new Float:PlayerOrigin[3]
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
entity_set_origin(tmpWall, PlayerOrigin)
//entity_set_edict(tmpWall, EV_ENT_owner, id)
new Float:vRetVector[3]
entity_get_vector(id, EV_VEC_v_angle, vRetVector)
vRetVector[0]=float(0)
entity_set_vector(tmpWall, EV_VEC_angles, vRetVector)
client_print(id,print_chat,"[AMXX][WALL MAKER] Wall #%i has been created.", wallCount)
wallEnts[wallCount] = tmpWall
g_theID = id
g_theWall = wallCount
set_task(2.0, "wallCreate2")
}
return PLUGIN_HANDLED
}
public wallCreate2() {
new tmpWall = wallEnts[g_theWall]
client_print(g_theID,print_chat,"[AMXX][WALL MAKER] Wall #%i is now solid.", g_theWall)
entity_set_int(tmpWall, EV_INT_solid, 2)
entity_set_int(tmpWall, EV_INT_movetype, 4)
wallEnts[g_theWall] = tmpWall
g_theWall = 0
g_theID = 0
}