SA-MP Forums Archive
NPC Errors - 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 Errors (/showthread.php?tid=103624)



NPC Errors - Matej682 - 20.10.2009

When i try to compile i get 4 errors:

Код:
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : error 012: invalid function call, not a valid address
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : warning 215: expression has no effect
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : warning 215: expression has no effect
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : error 001: expected token: ";", but found ")"
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : error 029: invalid expression, assumed zero
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : fatal error 107: too many error messages on one line
What to do?
The Search is not working sry for this topic.


Re: NPC Errors - Pawno_Master - 20.10.2009

You probably forogot something please show us the line 8 and some text aruound it


Re: NPC Errors - Matej682 - 20.10.2009

Код:
new ConnectNPC;
public OnFilterScriptInit()
{
  print("scriptfiles");
  ConnectNPC("Taxi","TAXI");
  return 1;
}
new MyFirstNPCVehicle; //Global variable!
publicOnFilterScriptInit()
{
  print("BlaBla");
  ConnectNPC("Taxi","TAXI");
  MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 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, "TAXI", 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;
}
here is the whole script


Re: NPC Errors - Cezar - 20.10.2009

Quote:

publicOnFilterScriptInit()

Missing a space?


Re: NPC Errors - Matej682 - 20.10.2009

Still not working


Re: NPC Errors - Pawno_Master - 20.10.2009

You can't use OnFilterScriptInit 2 times i think?


Re: NPC Errors - Matej682 - 20.10.2009

what should i do ?


Re: NPC Errors - yugokoral - 20.10.2009

Код:
new ConnectNPC;
public OnFilterScriptInit()
{
  print("scriptfiles");
  ConnectNPC("Taxi","TAXI");
  return 1;
}
new MyFirstNPCVehicle; //Global variable!
publicOnFilterScriptInit() //first here you havent a place public[place]OnFil........, second, you cant have 2Ч public OnFilterScriptInit()
{
  print("BlaBla");
  ConnectNPC("Taxi","TAXI");
  MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 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, "TAXI", 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;
}
Make this:
pawn Код:
new ConnectNPC; //you dont need this, because its already defined, so delete this...

public OnFilterScriptInit()
{
 
  ConnectNPC("Taxi","TAXI");
  MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
  return 1;
}

new MyFirstNPCVehicle; //Global variable!

}
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, "TAXI", 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;



Re: NPC Errors - Matej682 - 20.10.2009

When i do this then i get 5 Errors

Код:
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(7) : error 017: undefined symbol "ConnectNPC"
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(8) : error 017: undefined symbol "MyFirstNPCVehicle"
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(14) : error 054: unmatched closing brace ("}")
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(17) : error 017: undefined symbol "IsPlayerNPC"
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(29) : error 030: compound statement not closed at the end of file (started at line 17)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
EDIT: 2 Errors
Код:
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(7) : error 017: undefined symbol "ConnectNPC"
E:\GTA San Andreas\GTA San Andreas\GTA San Andreas\SAMP SERVER\filterscripts\TAXI.pwn(14) : error 017: undefined symbol "IsPlayerNPC"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: NPC Errors - yugokoral - 20.10.2009

Did you include a_npc!!!

You must include:
Код:
#include <a_npc>