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