Forráskód
THANKS, KURTA!
E:javárj... hiányos :angry: van benne 37 error ::|
static cell AMX_NATIVE_CALL n_CreateNPC( AMX* amx, cell* params )
{
int npcid = (int)params[1];
char* temp;
amx_StrParam(amx, params[2], temp);
if(!NPC[npcid])
{
NPC[npcid] = new CNPC(npcid,temp,1);
return 1;
}
return 0;
}
Ez még kijavítható
Amúgy meglehet csinálni alap NPC-vel.
Ha már ittvan kocsira az utközés:
void CNPC::VehicleKnock(int a_id,float pos_x,float pos_y,float pos_z,float v_x,float v_y,float v_z)
{
if((fly_x != 0.0) || (fly_y != 0.0) || (fly_z != 0.0)) return;
// npc pos
GetPos(&np_x,&np_y,&np_z);
pos_x += (v_x * 5) - np_x;
pos_y += (v_y * 5) - np_y;
pos_z += (v_z * 5) - np_z;
// if range
if(IsInRange(pos_x,pos_y,pos_z,1.0))
{
if(sqrt((v_x * v_x) + (v_y * v_y) + (v_z * v_z)) < 0.1) return;
fly_x = v_x * 2;
fly_y = v_y * 2;
fly_z = v_z * 2;
// less health
float health = GetHealth();
float dmg = sqrt((fly_x * fly_x) + (fly_y * fly_y) + (fly_z * fly_z)) * 20;
health -= dmg;
if(GetDamage(myid,a_id,dmg,4))
{
SetHealth(health);
if(health <= 0.0) Kill(a_id,47);
}
}
}