Many Checkpoints shown at once.
#1

Hey everyone
I will find some solution to it myself :P but maybe faster if i get some help
Or is there any other way of doin what i want to do?
Here's my code
Код:
#pragma tabsize 0
#include <a_samp>

//-------------------------------------------------
new traindriverlvvehicle;
new traindriverlsvehicle;
new traindriversfvehicle;
new pilotlvvehicle;
new pilotsfvehicle;
new pilotlsvehicle;
new shamalsfvehicle;
new hydrashipvehicle;
new lsairbikervehicle;         
new busgrovetolsairvehicle;
new train;
new train2;
new train3;
new LSRailwayStation[MAX_PLAYERS];
new SFRailwayStation[MAX_PLAYERS];
new LVRailwayStation[MAX_PLAYERS];



public OnFilterScriptInit()
{


	train=AddStaticVehicle(538, 1700.7551,-1953.6531,14.8756,200.0,-1,-1);
	train2=AddStaticVehicle(538, -1942.67, 170.58, 27.00, 200.0,-1,-1);
	train3=AddStaticVehicle(538, 2864.75, 1251.33, 12.13, 200.0,-1,-1);
/*	ConnectNPC("TrainDriverLV","train_lv");
  traindriverlvvehicle=CreateVehicle(569, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

	ConnectNPC("TrainDriverLS","train_ls");
	traindriverlsvehicle=CreateVehicle(569, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
	
	ConnectNPC("TrainDriverSF","train_sf");
	traindriversfvehicle=CreateVehicle(569, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); */
	
	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);
  
  ConnectNPC("LSAIRBIKER","lsairbiker");
  lsairbikervehicle=CreateVehicle(522, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
  
  ConnectNPC("BUSGROVETOLSAIR","busgrovetolsair");
  busgrovetolsairvehicle=CreateVehicle(437, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
  
  ConnectNPC("TrainDriverLStoLS","train_ls_to_ls");

	ConnectNPC("TrainDriverSFtoSF","train_sf_to_sf");

	ConnectNPC("TrainDriverLVtoLV","train_lv_to_lv");
  

	// 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,287,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"LSAIRBIKER",true))
	{
	  SetSpawnInfo(playerid,178,178,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
 	}
 	else if(!strcmp(playername,"BUSGROVETOLSAIR",true))
	{
	  SetSpawnInfo(playerid,61,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
 	}
 	else if(!strcmp(playername,"TrainDriverLStoLS",true))
	{
	  SetSpawnInfo(playerid,61,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
 	}
 	else if(!strcmp(playername,"TrainDriverSFtoSF",true))
	{
	  SetSpawnInfo(playerid,61,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
 	}
 	else if(!strcmp(playername,"TrainDriverLVtoLV",true))
	{
	  SetSpawnInfo(playerid,61,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
 	}
	return 0;
}

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

public OnPlayerSpawn(playerid)
{
  LSRailwayStation[playerid]=SetPlayerCheckpoint(playerid,1700.7551,-1953.6531,14.8756,5);
  SFRailwayStation[playerid]=SetPlayerCheckpoint(playerid,-1943.38,157.68,25.72,5);
  LVRailwayStation[playerid]=SetPlayerCheckpoint(playerid,2864.96,1256.93,10.82,5);


	if(!IsPlayerNPC(playerid))
	return 1;
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"TrainDriverLV",true))
	{
    PutPlayerInVehicle(playerid,traindriverlvvehicle,0);
    SetPlayerColor(playerid,0xFFFFFFFF);
    return 1;
 	}
	else if(!strcmp(playername,"TrainDriverSF",true))
	{
	  PutPlayerInVehicle(playerid,traindriversfvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
	else if(!strcmp(playername,"TrainDriverLS",true))
	{
	  PutPlayerInVehicle(playerid,traindriverlsvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
	else if(!strcmp(playername,"PilotLV",true))
	{
	  PutPlayerInVehicle(playerid,pilotlvvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
    return 1;
	}
	else if(!strcmp(playername,"PilotSF",true))
	{
	  PutPlayerInVehicle(playerid,pilotsfvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
	else if(!strcmp(playername,"PilotLS",true))
	{
	  PutPlayerInVehicle(playerid,pilotlsvehicle,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
	else if(!strcmp(playername,"TestIdleDriver",true))
	{
	  PutPlayerInVehicle(playerid,43,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
	else if(!strcmp(playername,"TaxiTest",true))
	{
	  PutPlayerInVehicle(playerid,968,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
	  return 1;
	}
 	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;
  }
  else if(!strcmp(playername, "LSAIRBIKER", true))
  {
      PutPlayerInVehicle(playerid, lsairbikervehicle, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
  else if(!strcmp(playername, "BUSGROVETOLSAIR", true))
  {
      PutPlayerInVehicle(playerid, busgrovetolsairvehicle, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverLStoLS", true))
  {
      PutPlayerInVehicle(playerid, train, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverSFtoSF", true))
  {
      PutPlayerInVehicle(playerid, train2, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverLVtoLV", true))
  {
      PutPlayerInVehicle(playerid, train3, 0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
  }
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{  if(LSRailwayStation[playerid]==1)
	{
	if(!IsPlayerNPC(playerid))
	{
	GameTextForPlayer(playerid,"~r~Welcome to Los Santos Railway Station!",3000,5);
  return 1;
  }

	new playername[64];
	GetPlayerName(playerid,playername,64);
	if(!strcmp(playername, "TrainDriverLStoLS", true))
  {
			GameTextForAll("Train starting from Los Santos has arrived at Los Santos Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverSFtoSF", true))
  {
      GameTextForAll("Train starting from San Fierro has arrived at Los Santos Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverLVtoLV", true))
  {
      GameTextForAll("Train starting from Las Venturas has arrived at Los Santos Railway Station.",3000,5);
      return 1;
  }
  return 1;
  }






	else if(SFRailwayStation[playerid]==1)
	{
	if(!IsPlayerNPC(playerid))
	{
	GameTextForPlayer(playerid,"~r~Welcome to San Fierro Railway Station!",3000,5);
  return 1;
  }

	new playername[64];
	GetPlayerName(playerid,playername,64);
	if(!strcmp(playername, "TrainDriverLStoLS", true))
  {
			GameTextForAll("Train starting from Los Santos has arrived at San Fierro Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverSFtoSF", true))
  {
      GameTextForAll("Train starting from San Fierro has arrived at San Fierro Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverLVtoLV", true))
  {
      GameTextForAll("Train starting from Las Venturas has arrived at San Fierro Railway Station.",3000,5);
      return 1;
  }
  return 1;
	}







	else if(LVRailwayStation[playerid]==1)
	{
	if(!IsPlayerNPC(playerid))
	{
	GameTextForPlayer(playerid,"~r~Welcome to Las Venturas Railway Station!",3000,5);
  return 1;
  }

	new playername[64];
	GetPlayerName(playerid,playername,64);
	if(!strcmp(playername, "TrainDriverLStoLS", true))
  {
			GameTextForAll("Train starting from Los Santos has arrived at Las Venturas Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverSFtoSF", true))
  {
      GameTextForAll("Train starting from San Fierro has arrived at Las Venturas Railway Station.",3000,5);
      return 1;
  }
  else if(!strcmp(playername, "TrainDriverLVtoLV", true))
  {
      GameTextForAll("Train starting from Las Venturas has arrived at Las Venturas Railway Station.",3000,5);
      return 1;
  }
  return 1;
  }
  



return 1;

}
Ok now i have only one checkpoint ingame(shud be 3)
And when i go to that checkpoint(Las Venturas railway station)
It shows welcome to lossantos railway station.

Help me!!!
Reply
#2

......
Reply
#3

Nobody?
Reply
#4

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
see there for an Importane Note
Reply
#5

Only one checkpoint can be shown at one time, Use a checkpoint streamer for more. But with a checkpoint streamer, you can only have one checkpoint (The closest) showing on your mini map.
Reply
#6

Ok is there any other i can show players that which train has arrived on which station?
There are three trains and three stations and for each train arriving on each station i want gametextforall be displayed?
I tried using checkpoints but it shows only when trains arrive at los santos railway station ..
Reply
#7

OnPlayerEnterCheckpoint()
When the NPC/Player go to the checkpoint, he's arrived, and make a new checkpoint.
So not need more than 1.
Reply
#8

Quote:
Originally Posted by [HUN
SeoTox[Clint] ]
OnPlayerEnterCheckpoint()
When the NPC/Player go to the checkpoint, he's arrived, and make a new checkpoint.
So not need more than 1.
Dude you didn't understand what i want to do.
How can one checkpoint work for three sttions with three trains??
I need some other solution,other than using checkpoints

Any other WAY??
Reply
#9

Train arrives, you set the checkpoint. Because the checkpoint is set, a big red square appears on the map. If you want more than 1 train at a time, use map icons and set the checkpoint for the closest train. A player can't possibly be at more than one train station at a time.

Also, you could always use pickups which are so many times better for this type of thing as OnPlayerPickUpPickup gives a pickupid not to mention you can use any object as a pickup and have hundreds of pickups and even thousands if streamed.
Reply
#10

Quote:
Originally Posted by Malice
Train arrives, you set the checkpoint. Because the checkpoint is set, a big red square appears on the map. If you want more than 1 train at a time, use map icons and set the checkpoint for the closest train. A player can't possibly be at more than one train station at a time.

Also, you could always use pickups which are so many times better for this type of thing as OnPlayerPickUpPickup gives a pickupid not to mention you can use any object as a pickup and have hundreds of pickups and even thousands if streamed.
Dude thanks.I will try to use pickups and see if it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)