NPC FS 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: NPC FS problem (
/showthread.php?tid=221490)
NPC FS problem -
sherlock - 05.02.2011
ok so im trying to create my first npc and i have done the recording no problem,now im trying to do the FS part.
Код:
#include <a_samp>
public OnFilterScriptInit()
{
print("my filterscript");
ConnectNPC("cop_car","copcarlol");
return 1;
}
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
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, "copcarlol", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//Other stuff for normal players goes here!
return 1;
}
C:\Users\The Matster\Downloads\copcarlol.pwn(10) : error 010: invalid function or declaration
C:\Users\The Matster\Downloads\copcarlol.pwn(11) : error 010: invalid function or declaration
C:\Users\The Matster\Downloads\copcarlol.pwn(22) : error 017: undefined symbol "MyFirstNPCVehicle"
Re: NPC FS problem -
Riddick94 - 05.02.2011
Код:
#include <a_samp>
new MyFirstNPCVehicle;
public OnFilterScriptInit()
{
print("my filterscript");
ConnectNPC("cop_car","copcarlol");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))return false; //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, "copcarlol", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
//Other stuff for normal players goes here!
return 1;
}
You need to define 'MyFirstNPCVehicle' and why did you made a:
Код:
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
without starting '{' ?
You just need to place it in OnFilterScriptInit
Re: NPC FS problem -
sherlock - 05.02.2011
Yeah i worked it out in the end,i forgot to add myfirstNPC vehicle at the top of the script. Thanks