AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with npc cso :( (https://forums.alliedmods.net/showthread.php?t=174307)

MONOPOL 12-18-2011 14:50

Help with npc cso :(
 
Hi guys i have sma of npc (Full version) but i dont understand have can i change models and i wont experiment so can anybody of you look sma ?
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <amxmisc>
#include <fakemeta>
#include <fun>

#define FAKEPLAYERSPEED 200 //dynamic fake-player run speed

new models[32][33],num
new body_ents[33][999]
new 
creators[33]
new 
exp
new bool:dynamic_ent[999]
new 
g_fwid
new 

public plugin_init(){
register_plugin("fake_player"," 0.8""Enigmaya")
register_clcmd("amx_create_fake","create_dynamic")
register_think("fake_player","ent_think")
unregister_forward(FM_PrecacheEventg_fwid1)
register_forward(FM_PlaybackEvent"fwPlaybackEvent")
createBots() 
set_task(3.0,"fake_create")
}

public 
fake_create(){
create_dynamic(t)
set_task(3.0,"fake_create")
}

public 
createBots(){
new 
botptr[128]
bot engfunc(EngFunc_CreateFakeClient"Fake Player")
dllfunc(DLLFunc_ClientConnectbot"Fake Player""127.0.0.1"ptr )
dllfunc(DLLFunc_ClientPutInServerbot)
cs_set_user_team(bot,CS_TEAM_T)
t=bot
}


public 
plugin_precache(){
expprecache_model("sprites/shockwave.spr")
num get_models(models,32)
for(new 
i=0;i<num;i++){
new 
modelstring[64];
format(modelstring,63,"models/player/%s/%s.mdl",models[i],models[i])
precache_model(modelstring)
}
g_fwid register_forward(FM_PrecacheEvent"fwPrecacheEvent"1)
}

public 
fwPlaybackEvent(flagsideventid) { 
new 
ent,body,ent_name[32],ent_ori[3],Float:ent_health
get_user_aiming 
(id,ent,body
if (
ent){
entity_get_string (entEV_SZ_classnameent_name31)
ent_health=entity_get_float(ent,EV_FL_health)
get_user_origin(id,ent_ori,3)
if(
equal(ent_name"fake_player")){
if(
ent_health<=0){
makeexp(ent_ori,20)
score(id
remove_entity(ent)
}
}
}


public 
showkill(killer,victim,head,weaponstr[]){

message_begin(MSG_ALL,get_user_msgid("DeathMsg"))

write_byte(killer)

write_byte(victim)

write_byte(head)

write_string(weaponstr)

message_end()
}

public 
score(killer){ 
showkill(killer,t,1,"")
}

public 
get_models(array[32][],len){
new 
dirposoutput[64], outlenfilledamt

// go through custom models
while((dirpos read_dir("models/player",dirpos,output,255,outlen)) != 0) {

if(
containi(output,".") == -1){
new 
modelfile[64]
format(modelfile,63,"models/player/%s/%s.mdl",output,output)
if(
file_exists(modelfile)) 
{
format(array[filledamt],len,"%s",output)
filledamt += 1
}
if(
filledamt 32
{
return 
filledamt
}
}
}
return 
filledamt
}

public 
create_dynamic(id){
new 
entid=try_build(id)
if( !
entid )
return 
PLUGIN_HANDLED
show_explode
(id
set_dynamic_sequence(id,entid)
entity_set_float(entid,EV_FL_nextthink,halflife_time() + 0.5
dynamic_ent[entid]=true

return PLUGIN_HANDLED 
}

try_build(id){
new 
Float:pOri[3]
entity_get_vector(idEV_VEC_originpOri)
new 
entid=build_now(pOriid)
drop_to_floor(entid)
return 
entid
}



set_dynamic_sequence(id,entPlayer){
new 
Float:Vel[3]
VelocityByAim(id,FAKEPLAYERSPEED,Vel)

new 
motion=4
Vel
[2]=float(0)
entity_set_vector(entPlayer,EV_VEC_velocity,Vel)//set Velocity
entity_set_int(entPlayer,EV_INT_sequence,motion
}

show_explode(id)
{
new 
ori[3]
get_user_origin(id,ori)
makeexp(ori,20)
}


public 
change_origin(id,entid,Float:pOri[3],Float:eOri[3])
{
if(!
is_user_alive(id) )
return 
PLUGIN_HANDLED

new ran=random(2)

switch(
ran){
case 
0:{
pOri[2]+=70.0
eOri
[2]+=65.0
entity_set_origin
(id,pOri)
entity_set_origin(entid,eOri)
}
case 
1:{
pOri[2]+=65.0
eOri
[2]+=70.0
entity_set_origin
(id,eOri)
entity_set_origin(entid,pOri)
}
}
return 
PLUGIN_CONTINUE




//----------------------------------build fake-player------------------------------
public build_now(Float:Ori[3],id)
{
new 
Float:Vel[3],Float:angle[3],pmodel[33

new 
entPlayercreate_entity("info_target")
if( !
entPlayer )
return 
0

entity_set_string
(entPlayerEV_SZ_classname"fake_player")

//--------set model----------
cs_get_user_model idpmodel32 )
new 
mstring[64]
pmodel=models[random_num(0,num-1)]
format(mstring,63,"models/player/%s/%s.mdl",pmodel,pmodel)
entity_set_model(entPlayermstring)

//-------base option-------
new Float:maxs[3] = {16.0,16.0,36.0
new 
Float:mins[3] = {-16.0,-16.0,-36.0
entity_set_size(entPlayer,mins,maxs
entity_set_int(entPlayerEV_INT_solid2)//SOLID_BBOX) 
entity_set_int(entPlayerEV_INT_movetype,MOVETYPE_NOCLIP)
entity_set_edict(entPlayerEV_ENT_ownert)

entity_set_float(entPlayer,EV_FL_takedamage,1.0)
entity_set_float(entPlayer,EV_FL_health,1.00)
entity_set_float(entPlayer,EV_FL_max_health,100.00)


//-------set origin--------

entity_set_origin(entPlayerOri)

//--------set animation-------
entity_set_float(entPlayer,EV_FL_animtime,2.0
entity_set_float(entPlayer,EV_FL_framerate,1.0

//-----------set angle-----------
VelocityByAim(id,FAKEPLAYERSPEED,Vel)
Vel[2]=float(0)
vector_to_angle(Vel,angle)
entity_set_vector(entPlayer,EV_VEC_angles,angle)
entity_set_vector(entPlayer,EV_VEC_v_angle,angle)

drop_to_floor(entPlayer)

body_ents[id][creators[id]] = entPlayer
dynamic_ent
[entPlayer]=false//initialize bool:dynamic_ent
return entPlayer
}




//-----------------------fake-player think--------------------------


public ent_think(entid){
if ( 
is_valid_ent(entid) ){
drop_to_floor(entid
new 
Float:fOri[3]
entity_get_vector(entid,EV_VEC_origin,fOri
find_way(entid,fOri)
entity_set_float(entid,EV_FL_nextthink,halflife_time() + 0.1)

return 
PLUGIN_CONTINUE
}

stop_fake(entid)
{
new 
Float:Vel[3]
Vel[0]=0.0
Vel
[1]=0.0
Vel
[2]=0.0
entity_set_vector
(entid,EV_VEC_velocity,Vel)
entity_set_int(entid,EV_INT_sequence,1)
}

stock DirectedVec(Float:start[3],Float:end[3],Float:reOri[3])
{
//-------code from Hydralisk's 'Admin Advantage'-------// 
new Float:v3[3]
v3[0]=start[0]-end[0]
v3[1]=start[1]-end[1]
v3[2]=start[2]-end[2]
new 
Float:vl vector_length(v3)
reOri[0] = v3[0] / vl
reOri
[1] = v3[1] / vl
reOri
[2] = v3[2] / vl
}

public 
makeexp(ori[3],times){
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(3)
write_coord(ori[0])
write_coord(ori[1])
write_coord(ori[2])
write_short(exp)
write_byte(times)
write_byte(10)
write_byte(0)
message_end()
}

find_way(entid,Float:fOri[3])
{
new 
Float:vTrace[3],Float:vTraceEnd[3],Float:hitOri[3],Float:Vel[3],Float:angle[3]
// set a entPos to trace a line
velocity_by_aim(entid64vTrace
vTraceEnd[0] = vTrace[0] + fOri[0
vTraceEnd[1] = vTrace[1] + fOri[1]
vTraceEnd[2] = vTrace[2] + fOri[2]+25
new hitent=trace_line(entidfOrivTraceEndhitOri)

//check the trace return values to check is player hit something...
//doesn't check the hit entity, 
//because if hit nothing,will return 0. and if hit the wall,also return 0.
new Float:gdis=vector_distance(fOri,hitOri)

//set another entPos to trace another line
velocity_by_aim(entid45vTrace
vTraceEnd[0] = vTrace[0] + fOri[0
vTraceEnd[1] = vTrace[1] + fOri[1]
vTraceEnd[2] = vTrace[2] + fOri[2]-45// lower than first dot
trace_line(entidfOrivTraceEndhitOri)

new 
Float:gdis2=vector_distance(fOri,hitOri)

if( 
gdis2<43 ){
entity_get_vector(entid,EV_VEC_origin,fOri)
fOri[2]+=10
entity_set_vector
(entid,EV_VEC_origin,fOri)


entity_get_vector(entid,EV_VEC_velocity,Vel)
if( 
hitent || gdis<60 ){
//stop
stop_fake(entid)

//turn random angle 
entity_get_vector(entid,EV_VEC_v_angle,angle)
new 
Float:fnum=random_float(-90.0,90.0)
angle[1]+=fnum
//angle[1]+=90.0
entity_set_vector(entid,EV_VEC_v_angle,angle)
return
}
if( 
Vel[0]==0.0 || Vel[1]==0.0 ){
VelocityByAim(entid,FAKEPLAYERSPEED,Vel)
Vel[2]=0.0
vector_to_angle
(Vel,angle)
entity_set_vector(entid,EV_VEC_angles,angle
entity_set_vector(entid,EV_VEC_velocity,Vel)
entity_set_int(entid,EV_INT_sequence,4




MONOPOL 12-18-2011 14:52

Re: Help with npc cso :(
 
I have some good model but i dont know where in that sma to write it :(

Juk0 12-18-2011 15:43

Re: Help with npc cso :(
 
PHP Code:

cs_get_user_model*(*id,*pmodel,*32*) new*mstring[64pmodel=models[random_num(0,num-1)] format(mstring,63,"models/player/%s/%s.mdl",pmodel,pmodelentity_set_model(entPlayer,*mstring 

There?

MONOPOL 12-19-2011 11:34

Re: Help with npc cso :(
 
I want to know where i can tape name of model :(

joshknifer 12-19-2011 13:27

Re: Help with npc cso :(
 
Your post says this is for CSO?

MONOPOL 12-20-2011 13:09

Re: Help with npc cso :(
 
Cs 1,6 :)

fysiks 12-20-2011 15:48

Re: Help with npc cso :(
 
Quote:

Originally Posted by MONOPOL (Post 1616599)
Cs 1,6 :)

It says CSO in the thread title.

MONOPOL 12-21-2011 12:09

Re: Help with npc cso :(
 
Thats the name of plugin -.- ALIEN BOSS NPC CSO :(

JoKeR LauGh 12-21-2011 12:11

Re: Help with npc cso :(
 
I don't know , but what is the problem?

fysiks 12-21-2011 15:29

Re: Help with npc cso :(
 
Quote:

Originally Posted by MONOPOL (Post 1617129)
Thats the name of plugin -.- ALIEN BOSS NPC CSO :(

No, it's not, the name of the plugin is "fake_player". You need to post in the plugin's thread.


All times are GMT -4. The time now is 11:53.

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