rIIven
Дебютант
Eu queria que quando eu atirasse em um objeto específico, depois de 100 tiros ele fosse destruído, isso funciona, mas depois da destruição, sempre que eu atirasse em outro objeto que não tivesse nada a ver com ele, ele também seria destruído
desculpe pela língua russa, eu uso um tradutor.
Я хотел, чтобы, когда я стрелял в определенный объект, после 100 выстрелов он был уничтожен, это работает, но после уничтожения всякий раз, когда я стрелял в другой объект, который не имел к нему никакого отношения, он также был уничтожен
PHP:
newtorres[3];
cmd:ct(playerid, parâmetros[])
{
torres[0] = CreateObject(19437, 1174.9011, -2007.8671, 69.0006, 0.0000, 0.0000, 0.0000, 0.0);
torres[1] = CreateObject(19437, 1176.9011, -2007.8671, 69.0006, 0.0000, 0.0000, 0.0000, 0.0);
torres[2] = CreateObject(19437, 1179.9011, -2007.8671, 69.0006, 0.0000, 0.0000, 0.0000, 0.0);
retornar 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
novo str[256];
if(hittype == BULLET_HIT_TYPE_OBJECT)
{
if(IsValidObject(hitid))
{
if(hitid == torres[0] || hitid == torres[1] || hitid == torres[2])
{
tirostorreevento -= 1;
format(str, sizeof(str), "%d", tirostorreevento);
SendClientMessage(playerid, -1, str);
if(tirotorreevento == 0)
{
destruirtodasastorres();
SendClientMessage(playerid, -1, "voce chegou em 0 tiros");
}
}
}
}
retornar 1;
}
forward destruirtodasastorres();
public destruirtodasastorres()
{
tirotorreevento = 100;
for(new i = 0; i < sizeof(torres); i++)
{
if(IsValidObject(torres[i]))
{
DestroyObject(torres[i]);
}
}
retornar 1;
}[/codigo]
Последнее редактирование модератором:
