NPC Errors
#1

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.
Reply
#2

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

Код:
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
Reply
#4

Quote:

publicOnFilterScriptInit()

Missing a space?
Reply
#5

Still not working
Reply
#6

You can't use OnFilterScriptInit 2 times i think?
Reply
#7

what should i do ?
Reply
#8

Код:
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;
Reply
#9

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.
Reply
#10

Did you include a_npc!!!

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


Forum Jump:


Users browsing this thread: 1 Guest(s)