03.09.2016, 19:42
o hitid pega o id do objeto entгo vocк destroi o id que levou o dano..
um exemplo:
Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { new msg[100]; if(hittype == BULLET_HIT_TYPE_OBJECT) { if(IsValidObject(hitid)) { DestroyObject(hitid); format(msg, sizeof(msg), "vocк matou o veado com a arma id %i, o veado id %i ", weaponid, hitid); SendClientMessage(playerid, -1, msg); } } return 1; }
Code:
new Veados[5]; Veados[0] = CreateObject(19315, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0, 300.0); Veados[1] = CreateObject(19315, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0, 300.0); Veados[2] = CreateObject(19315, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0, 300.0); Veados[3] = CreateObject(19315, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0, 300.0); Veados[4] = CreateObject(19315, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0, 300.0);
Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if(hittype == BULLET_HIT_TYPE_OBJECT) { if(IsValidObject(hitid)) { for(new a; a < sizeof(Veados); ++a) { if(hitid == Veados[a]) { new msg[100]; DestroyObject(hitid); format(msg, sizeof(msg), "vocк matou o veado com a arma id %i, o veado id %i - %i", weaponid, hitid, Veados[a]); SendClientMessage(playerid, -1, msg); break; } } } } return 1; }