Quote:
Originally Posted by jim_yang
are you sure your code works? i see you just set the origin of the same ent three times.
|
I should of shown part of the full code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
new g_origin[3]
new const validents[4][256] = {
"monster_zombie",
"monster_scientist",
"monster_barney",
"monster_sentry"
}
public plugin_init() {
register_plugin("Circle Test","1.0","")
register_concmd("amx_circle","find_ent2")
}
public find_ent2(id) {
new random_player = random_num(1,get_playersnum()) //Apprently this always doesn't return true player indexs
if(is_user_connected(random_player) && is_user_alive(random_player))
{
new Float:origin[3],classname[32],ent,i
pev(random_player,pev_origin,origin)
while((ent = engfunc(EngFunc_FindEntityInSphere,ent,origin,10000.0)) != 0 ) {
for(i=0;i<sizeof(validents);i++) {
pev(ent, pev_classname, classname, 31)
if(equali(classname,"monster_sentry")) {
npc_rotate(ent,random_player)
break;
}
}
}
}
return PLUGIN_HANDLED
}
public npc_rotate(ent,player)
{
new Float:entorigin[3],Float:playerorigin[3],i
pev(ent,pev_origin,entorigin)
pev(player,pev_origin,playerorigin)
g_origin[0] += 30
g_origin[1] += 10
g_origin[2] += 0
for(i=0;i<3;i++) {
playerorigin[i] += g_origin[i]
set_pev(ent,pev_origin,playerorigin)
console_print(0,"[POWER NPC] For called")
}
return PLUGIN_HANDLED
}
But yes, tested it and works fine.
@lunarwolfx
There's a total of six monsters (Sentrys) around the player, it's always the same amount, and always in the same place. It's simply suppose to place itself around the player, and spin around the player untill his/her death.