[HELP]Error in NPC script.Here's the code!
#1

Ok i tried to add my 2 npcs(shamalsf and hydraship ) in the gl_npcs and it gives me three errors and three warnings.
Can someone help??

C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(127) : warning 217: loose indentation
C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(132) : warning 217: loose indentation
C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(132) : error 029: invalid expression, assumed zero
C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(132) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(137) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Users\Dhananjay\Desktop\SA MP Windows Server\filterscripts\gl_npcs.pwn(200) : error 030: compound statement not closed at the end of file (started at line 82)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase



Код:
#pragma tabsize 0
#include <a_samp>

//-------------------------------------------------
new pilotlvvehicle;
new pilotsfvehicle;
new pilotlsvehicle;
new shamalsfvehicle;
new hydrashipvehicle;

public OnFilterScriptInit()
{
	ConnectNPC("TrainDriverLV","train_lv");
	ConnectNPC("TrainDriverLS","train_ls");
	ConnectNPC("TrainDriverSF","train_sf");
	
	ConnectNPC("PilotLV","at400_lv");
	pilotlvvehicle=CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

	ConnectNPC("PilotSF","at400_sf");
	pilotsfvehicle=CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

	ConnectNPC("PilotLS","at400_ls");
	pilotlsvehicle=CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
	
	ConnectNPC("SHAMALSFPILOT","shamalsf");
  shamalsfvehicle=CreateVehicle(519, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

  ConnectNPC("HYDRASHIPPILOT","hydraship");
  hydrashipvehicle = CreateVehicle(520, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

	// Testing
	//ConnectNPC("TestIdle","onfoot_test");
	//ConnectNPC("TaxiTest","mat_test");
	
	return 1;
}

//-------------------------------------------------
// IMPORTANT: This restricts NPCs connecting from
// an IP address outside this server. If you need
// to connect NPCs externally you will need to modify
// the code in this callback.

public OnPlayerConnect(playerid)
{
	if(IsPlayerNPC(playerid))
	{
	  new ip_addr_npc[64+1];
	  new ip_addr_server[64+1];
	  GetServerVarAsString("bind",ip_addr_server,64);
	  GetPlayerIp(playerid,ip_addr_npc,64);
	  
		if(!strlen(ip_addr_server)) {
		  ip_addr_server = "127.0.0.1";
		}
		
		if(strcmp(ip_addr_npc,ip_addr_server,true) != 0)
		{
		  // this bot is remote connecting
		  printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
		  Kick(playerid);
		  return 0;
		}
    printf("NPC: Connection from %s is allowed.",ip_addr_npc);
	}
	
	return 1;
}

//-------------------------------------------------

public OnPlayerRequestClass(playerid, classid)
{
	if(!IsPlayerNPC(playerid))
	return 0; // We only deal with NPC players in this script

	new playername[64];
	GetPlayerName(playerid,playername,64);

 	if(!strcmp(playername,"TrainDriverLV",true))
	 {
    SetSpawnInfo(playerid,69,255,1462.0745,2630.8787,10.8203,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"TrainDriverSF",true))
	{
	  SetSpawnInfo(playerid,69,255,-1942.7950,168.4164,27.0006,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"TrainDriverLS",true))
	{
	  SetSpawnInfo(playerid,69,255,1700.7551,-1953.6531,14.8756,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"PilotLV",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"PilotSF",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"PilotLS",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"TestIdleDriver",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"TaxiTest",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
  else if(!strcmp(playername,"SHAMALSFPILOT",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"HYDRASHIPPILOT",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	return 0;
}

//-------------------------------------------------

public OnPlayerSpawn(playerid)
{
	if(!IsPlayerNPC(playerid))
	return 1; // We only deal with NPC players in this script

	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"TrainDriverLV",true))
	{
    PutPlayerInVehicle(playerid,1,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
 	}
	else if(!strcmp(playername,"TrainDriverSF",true))
	{
	  PutPlayerInVehicle(playerid,5,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"TrainDriverLS",true))
	{
	  PutPlayerInVehicle(playerid,9,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"PilotLV",true))
	{
	  PutPlayerInVehicle(playerid,pilotlvvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"PilotSF",true))
	{
	  PutPlayerInVehicle(playerid,pilotsfvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"PilotLS",true))
	{
	  PutPlayerInVehicle(playerid,pilotlsvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"TestIdleDriver",true))
	{
	  PutPlayerInVehicle(playerid,43,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
	else if(!strcmp(playername,"TaxiTest",true))
	{
	  PutPlayerInVehicle(playerid,968,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	}
 	else if(!strcmp(playername, "SHAMALSFPILOT", true))
  {
      PutPlayerInVehicle(playerid, shamalsfvehicle, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
  else if(!strcmp(playername, "HYDRASHIPPILOT", true))
  {
      PutPlayerInVehicle(playerid, hydrashipvehicle, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }

	return 1;
}
Reply
#2

COOL COOL!
I got the error.
A silly missing curly bracket!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)