Well, today i come to demonstrate simple examples to appear BOT's, thanks to the creation of the FCNPC by OrMisicL. (It's my firts post and filterscript).
It is important to emphasize that you have to have a little knowledge in FCNPC to be able to carry out these activities.
I'll start with the simple, includes, define MAX_BOTS and commands:
This will be the command to start the functions of the BOT's
Following this, i will describe the main functions of the BOTS, spawn, attack and death
It should be noted that this tutorial is simple, according to your knowledge you can improve it.
Attachment 11382 - archives for the BOT's
Attachment 11383 - includes required
Original post of the creation( http://forum.sa-mp.com/showthread.php?t=428066 )
It is important to emphasize that you have to have a little knowledge in FCNPC to be able to carry out these activities.
I'll start with the simple, includes, define MAX_BOTS and commands:
PHP Code:
#include a_samp
#include foreach
#include zcmd //or Pawn.cmd
#include FCNPC //required
#define MAX_BOTS 1 //the number can change, it depends on how many bots you want to appear
forward Move(npcid);//required
PHP Code:
CMD:joinzombies(playerid, params[])return start_zombies(playerid);
PHP Code:
stock start_zombies(playerid)
{
FCNPC_SetUpdateRate(100);// I recommend leaving it like this (configuration by OrMisicL)
for(new i = 0; i < MAX_BOTS; i++)
{
new string[30];
format(string, sizeof(string), "zombie_%d", i + 1);//name for the BOT's
new npcid = FCNPC_Create(string);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
FCNPC_Spawn(npcid, 87, x,y+3,z);//Spawnear bots according to your position
FCNPC_SetHealth(npcid,100.0);//set health for the BOT's
FCNPC_MeleeAttack(npcid, -1, true);
FCNPC_SetSkin(npcid,77);//skin for the BOT's
SetTimerEx("Move",100,1,"i",npcid);//timer for the move of the BOTS
}
return 1;
}
public Move(npcid)
{
new Float:p[3];
foreach(Player,i)
{
GetPlayerPos(i,p[0],p[1],p[2]);
if(IsPlayerInRangeOfPoint(npcid,50,p[0],p[1],p[2]))
{
FCNPC_IsAttacking(npcid);
FCNPC_GoTo(npcid,p[0],p[1],p[2],MOVE_TYPE_SPRINT,2);
}
}
return 1;
}
//A simple example of a shot to the head for the BOT, with sniper, desert_eagle and silenced 9mm
public FCNPC_OnTakeDamage(npcid, damagerid, weaponid, bodypart)
{
if(weaponid == 34 && weaponid == 24 && weaponid == 23 && bodypart == 9)
{
FCNPC_SetHealth(npcid,0);
}
return 1;
}
//And finally, a simple example when the BOT kills you
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerNPC(killerid))//BOT kill
{
GameTextForPlayer(playerid,"_~n~_~n~_~n~_~n~_~n~_~n~_~n~~r~zombie_win",4000,6);
}
else
{
if(IsPlayerConnected(killerid))//normal kill
{
GameTextForPlayer(playerid,"owned", 3000, 6);
}
}
return 1;
}
Attachment 11382 - archives for the BOT's
Attachment 11383 - includes required
Original post of the creation( http://forum.sa-mp.com/showthread.php?t=428066 )
I accept all kinds of suggestions, a bug or error comment here.