Tworze kilka entów które mają "myśleć" i jak w temacie jak lepiej to rozegrać, dla każdego użyć register_think z engine, czy może lepiej FM_Think, podobne pytanie mam co do register_touch a FM_Touch, jak na razie mój kod wygląda tak:
public EntityThink(ent){
if(!pev_valid(ent))
return FMRES_IGNORED;
static classname[32];
pev(ent, pev_classname, classname, 31);
if(equal(classname, entity_classanme[ClassnameClaymore])){
static entlist[MAX+1], numfound, enemyfound, pid, owner;
numfound = fm_find_sphere_class(ent, "player", 100.0, entlist, MAX);
owner = pev(ent, pev_owner);
enemyfound = 0;
for(new i = 0; i < numfound; i ++){
pid = entlist[i];
if(!is_user_alive(pid) || is_same_team(owner, pid))
continue;
enemyfound ++;
if(perk_klasy[pid][klasa_gracza[pid]][1] == PERK_JEDNOOSOBOWAARMIA)
continue;
ExecuteHam(Ham_TakeDamage, pid, ent, owner, 100.0, (1<<1));
}
if(!enemyfound){
set_pev(ent, pev_nextthink, get_gametime() + 0.1);
return FMRES_IGNORED;
}
create_sphere(ent, 125);
create_blast(ent);
engfunc(EngFunc_RemoveEntity, ent);
return FMRES_IGNORED;
}
return FMRES_IGNORED;
}
public EntityTouch(ent, this){
if(!pev_valid(ent))
return FMRES_IGNORED;
static classname[2][32], owner;
pev(this, pev_classname, classname[1], 31);
pev(ent, pev_classname, classname[0], 31);
if(equal(classname[0], "grenade")){
owner = pev(ent, pev_owner);
if(ekwipunek_klasy[owner][klasa_gracza[owner]] != EKW_SEMTEX)
return FMRES_IGNORED;
if(equal(classname[1], "player")){
if(!is_user_alive(this) || is_same_team(owner, this) || pev(ent, pev_movetype) != MOVETYPE_FOLLOW){
set_pev(ent, pev_movetype, MOVETYPE_FOLLOW);
set_pev(ent, pev_solid, SOLID_TRIGGER);
set_pev(ent, pev_aiment, this);
set_pev(ent, pev_sequence, 0);
AddMessage(owner, "PRZYKLEJONY");
return FMRES_IGNORED;
}
}
set_pev(ent, pev_movetype, MOVETYPE_FOLLOW);
set_pev(ent, pev_sequence, 0);
return FMRES_IGNORED;
}
if(equal(classname[0], entity_classanme[ClassnameMina])){
if(!equal(classname[1], "player"))
return FMRES_IGNORED;
owner = pev(ent, pev_owner);
if(is_same_team(this, owner))
return FMRES_IGNORED;
static entlist[MAX+1], numfound, pid;
numfound = fm_find_sphere_class(ent, "player", 75.0, entlist, MAX);
for(new i = 0; i < numfound; i ++){
pid = entlist[i];
if(!is_user_alive(pid) || is_same_team(owner, pid))
continue;
if(perk_klasy[pid][klasa_gracza[pid]][1] == PERK_JEDNOOSOBOWAARMIA)
continue;
ExecuteHam(Ham_TakeDamage, pid, ent, owner, 100.0, (1<<1));
}
create_blast(ent);
engfunc(EngFunc_RemoveEntity, ent);
}
return FMRES_IGNORED;
}
Proszę o jak najszybsza poradę ![]()


Dodatki SourceMod












