Need Help with NPC - 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: Need Help with NPC (
/showthread.php?tid=177320)
Need Help with NPC -
Libra_PL - 17.09.2010
I used the tutorial about NPCs by kc, yes... But here's the problem...
I recorded one with name "Line_1" (with /vrecord). I did and compiled the file to npcmodes, then I added to my gamemode these stuff:
Then
Код:
public OnPlayerRequestSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
return 1;
}
Later...
Код:
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, "Line_1", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Line1, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//My stuff here :)
return 1;
}
Then...
Код:
public OnGameModeInit()
{
ConnectNPC("Line_1","Line_1");
Line1 = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, -1, -1, 999999999);
That's all. My problem is here, the NPC doesn't appear. It only says in samp-server.exe:
Код:
Incoming connection: 127.0.0.1:1748
The number of slots doesn't change from 125 to 124, when I come in-game, it doesn't appear.
Help?
Re: Need Help with NPC -
Libra_PL - 17.09.2010
Fixed. I had number "maxnpcs": 0. My fail.
Re: Need Help with NPC -
FireCat - 17.09.2010
rofl xD thats shit xD