How to NPC respawn?
#1

Hi, I am making bots, but i don't know - how to respawn npc? I made SpawnPlayer, but it doesn't work.
Sorry for my bad english, i am from czech republic
Reply
#2

Why do you need it?
Reply
#3

I need it, because i am doing, that when bot has <bot = 2> (player is shooting to him) he is dead (respawn)
Reply
#4

Use SetPlayerPos
Reply
#5

and when bot will has some x, y, z ... he will back to start recording? and thanks.. rep+
Reply
#6

SpawnPlayer should work though ..

i have tested it myself it works i haZ a command to fix player that respawn player to RandomSpawn points
similarly,
i tried it on my bot it fixed him he first got spawned at his other player spawn position than after 4-5 sec he got spawned at HIS ddefault position i.e. where playback starts
Reply
#7

Is it right?
In OnPlayerSpawn, I have bot[0 - 10] = 10;

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
	if(IsPlayerNPC(damagedid))
	{
		new npcname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, npcname, sizeof(npcname));
		if(!strcmp(npcname, "BOT", true))
		{
			bot[1]--;
		}
		if(!strcmp(npcname, "BOT2", true))
		{
			bot[2]--;
		}
		if(!strcmp(npcname, "BOT3", true))
		{
			bot[3]--;
		}
		if(!strcmp(npcname, "BOT4", true))
		{
			bot[4]--;
		}
 		if(!strcmp(npcname, "BOT5", true))
		{
			bot[5]--;
		}
 		if(!strcmp(npcname, "BOT6", true))
		{
			bot[6]--;
		}
 		if(!strcmp(npcname, "BOT7", true))
		{
			bot[7]--;
		}
 		if(!strcmp(npcname, "BOT8", true))
		{
			bot[8]--;
		}
 		if(!strcmp(npcname, "BOT9", true))
		{
			bot[9]--;
		}
 		if(!strcmp(npcname, "BOT10", true))
		{
			bot[10]--;
		}
		if(!strcmp(npcname, "BOT11", true))
		{
			bot[11]--;
		}
	}
	return 1;
}
Код:
public OnPlayerUpdate(playerid)
{
	if(IsPlayerNPC(playerid))
	{
		new npcname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, npcname, sizeof(npcname));
		if(!strcmp(npcname, "BOT", true))
		{
			if(bot[1] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
		if(!strcmp(npcname, "BOT2", true))
		{
			if(bot[2] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
		if(!strcmp(npcname, "BOT3", true))
		{
			if(bot[3] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
		if(!strcmp(npcname, "BOT4", true))
		{
			if(bot[4] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT5", true))
		{
			if(bot[5] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT6", true))
		{
			if(bot[6] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT7", true))
		{
			if(bot[7] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT8", true))
		{
			if(bot[8] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT9", true))
		{
			if(bot[9] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
 		if(!strcmp(npcname, "BOT10", true))
		{
			if(bot[10] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
		if(!strcmp(npcname, "BOT11", true))
		{
			if(bot[11] == 2)
			{
			    SpawnPlayer(playerid);
			}
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)