SA-MP Forums Archive
Bots problem !!! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Bots problem !!! (/showthread.php?tid=106096)



Bots problem !!! - Raul_Ro - 01.11.2009

We created a BOT, but ... does not work.
I did it:
I registered and then I put everything into place and then I wrote the following in GM:
Код:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "aa", true)) //Checking if the NPC's name is Correct
    {
      SetPlayerSkin(playerid, 264);
    }
    return 1;
  }
	return 1;
}
Код:
public OnGameModeInit()
{
  ConnectNPC("aaaa","aa");
  return 1;
}
I gave compile and entered the server.
NPC's and it's connected but .... not do what made me do. why is it?
case is that I and this:
Код:
public OnPlayerSpawn(playerid)
{
SetPlayerRandomSpawn(playerid);
return 1;
}
?
Is it for me the player spawn-booking to start in several places, and the bot can not get where they start working?
If so .... can resolve to go to my server and bots?


Re: Bots problem !!! - Luka P. - 01.11.2009

Read the Creating a NPC tutorial again.
You did not create a vehicle for bot, so you have to CreateVehicle(Ex) / AddStaticVehicle(Ex) and put NPC in that vehicle.


Re: Bots problem !!! - Raul_Ro - 01.11.2009

Quote:
Originally Posted by Luka™
Read the Creating a NPC tutorial again.
You did not create a vehicle for bot, so you have to CreateVehicle(Ex) / AddStaticVehicle(Ex) and put NPC in that vehicle.
What Car? I put no car. ie I used /ofrecord not /vrecord !
Another solution?


Re: Bots problem !!! - Jefff - 01.11.2009

ConnectNPC("aaaa","aa");
bot name
if(!strcmp(npcname, "aa", true)) //Checking if the NPC's name is Correct
{
SetPlayerSkin(playerid, 264);
}
should be "aaaa"