How to NPC respawn? -
SweetCZ - 02.06.2012
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
Re: How to NPC respawn? -
MadeMan - 02.06.2012
Why do you need it?
Re: How to NPC respawn? -
SweetCZ - 02.06.2012
I need it, because i am doing, that when bot has <bot = 2> (player is shooting to him) he is dead (respawn)
Re: How to NPC respawn? -
MadeMan - 02.06.2012
Use SetPlayerPos
Re: How to NPC respawn? -
SweetCZ - 02.06.2012
and when bot will has some x, y, z ... he will back to start recording? and thanks.. rep+
Re: How to NPC respawn? -
Niko_boy - 02.06.2012
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
Re: How to NPC respawn? -
SweetCZ - 02.06.2012
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;
}