ayuda bots atascados en blueberry
#1

Ayuda los npcs no hacen spawn y estan en blueberry

Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's




new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);

//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls

	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    else if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	else if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	else if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	return 1;
    }

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"


};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
    if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
    printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
    ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
    SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Reply
#2

Quote:
Originally Posted by miguelangel988
Посмотреть сообщение
Ayuda los npcs no hacen spawn y estan en blueberry

Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's




new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);

//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls

	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    else if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	else if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	else if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	return 1;
    }

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"


};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
    if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
    printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
    ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
    SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's




new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);

//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls

	return 1;
}

public OnPlayerSpawn(playerid)
{
    //if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    else if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	else if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	else if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	return 1;
    }

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"


};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
    if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
    printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
    ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
    SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Creo asi deberia funcionar
Reply
#3

Quote:
Originally Posted by RedSamp
Посмотреть сообщение
Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's




new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);

//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls

	return 1;
}

public OnPlayerSpawn(playerid)
{
    //if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    else if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	else if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	else if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	else if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	return 1;
    }

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"


};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
    if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
    printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
    ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
    SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Creo asi deberia funcionar
el id 1 esta atascado en blueberry pero los demas funcionan bien
Reply
#4

Quote:
Originally Posted by miguelangel988
Посмотреть сообщение
el id 1 esta atascado en blueberry pero los demas funcionan bien
Entonces es asi:
Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's
new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);
//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls
	return 1;
}

public OnPlayerSpawn(playerid)
{
    //if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	return 1;
}

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"
};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Reply
#5

Quote:
Originally Posted by RedSamp
Посмотреть сообщение
Entonces es asi:
Код:
#include <a_samp>
#include <a_npc>
#define COLOR_GREEN 0x33AA33AA
//so Far there are 68 NPC's
new Beagle;
new Plane1,Plane2,Plane3;
new Tug;
new Dodo;
new trenls;

public OnGameModeInit()
{
	ConectarNPCS(0);
//---This makes the Npc's spawn--
	Beagle = AddStaticVehicle(511,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane1 = AddStaticVehicle(77,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane2 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Plane3 = AddStaticVehicle(577,-1988.0057,116.6116,27.6411,0.6686,75,59);
	Tug =	AddStaticVehicle(583,1633.1984,1648.5555,10.3607,177.7618,1,1); // tug
	Dodo =	AddStaticVehicle(593,1327.7201,1581.3104,11.2769,271.5139,51,1); // dodo
	trenls = AddStaticVehicle(537,2188.7000000,-1932.8000000,15.0000000,320.0000000,245,245); // tren carga ls
	return 1;
}

public OnPlayerSpawn(playerid)
{
    //if(IsPlayerNPC(playerid)) return 1;
	//if(!IsPlayerNPC(playerid)) return 0;
   	new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Beagle",true)) {
        SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Beagle, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
	    //new Text3D:beagle = Create3DTextLabel("NPC_BeagleDriver(ID:2)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(beagle, playerid, 0.0, 0.0, 0.5);
	}
    if(!strcmp(playername,"Pilot_ymtisd",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane1, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD1 = Create3DTextLabel("NPC_PilotYmtisd(ID:3)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Pilot_Flake",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  	PutPlayerInVehicle(playerid, Plane2, 0);
	  	SetPlayerColor(playerid,0xFFFFFFAA);
	  	//new Text3D:PTD2 = Create3DTextLabel("NPC_PilotFlake(ID:4)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD2, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Pilot_Pip",true)) {
	    SetSpawnInfo(playerid,0,255,1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
   		PutPlayerInVehicle(playerid, Plane3, 0);
   		SetPlayerColor(playerid,0xFFFFFFAA);
   		//new Text3D:PTD3 = Create3DTextLabel("NPC_PilotPip(ID:5)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD3, playerid, 0.0, 0.0, 0.5);
 	}
	if(!strcmp(playername,"Tug",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, Tug, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}

	if(!strcmp(playername,"Dodo",true)) {
	    SetSpawnInfo( playerid, 0, 187, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
		PutPlayerInVehicle(playerid, Dodo, 0);
		SetPlayerColor(playerid,0x330066AA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_DodoPilot(ID:13)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	if(!strcmp(playername,"Trenls",true)) {
        SetSpawnInfo( playerid, 0, 16, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	    PutPlayerInVehicle(playerid, trenls, 0);
	    SetPlayerColor(playerid,0xFFFFFFAA);
		//new Text3D:PTD1 = Create3DTextLabel("NPC_TugDriver(ID:11)",0x33AA33AA,30.0,40.0,50.0,40.0,0);
     	//Attach3DTextLabelToPlayer(PTD1, playerid, 0.0, 0.0, 0.5);
	}
	return 1;
}

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;
}

new const NPC_LIST[][] = { //EJEMPLO DE LISTA (REMPLAZA LOS NOMBRES POR LOS TUYOS)
    "Beagle","Beagle",
    "Pilot_ymtisd","at400_lv",
    "Pilot_pip","at400_sf",
    "Pilot_Flake","at400_ls",
    "Tug","tug",
    "Dodo","dodo",
    "trenls","trenls"
};

forward ConectarNPCS(pos); //PEGA ESTO EN LA ULTIMA LINEA DE TU GM
public  ConectarNPCS(pos) {
if(pos >= sizeof(NPC_LIST)) { printf("LISTA DE NPCS COMPLETADA"); return; }
printf("CONECTANDO NPC: %s | SCRIPT: %s",NPC_LIST[pos],NPC_LIST[pos+1]);
ConnectNPC(NPC_LIST[pos],NPC_LIST[pos+1]);
SetTimerEx("ConectarNPCS",5000,false,"i",pos+=2);//EL 5000 ES EL DELAY DE 5 SEGUNDOS
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)