[Ajuda] OnPlayerWeaponShot
#4

o hitid pega o id do objeto entгo vocк destroi o id que levou o dano..
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;
}
um exemplo:
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;
}
Reply


Messages In This Thread
OnPlayerWeaponShot - by OtimoJogo - 03.09.2016, 19:06
Re: OnPlayerWeaponShot - by Andinho - 03.09.2016, 19:29
Re: OnPlayerWeaponShot - by OtimoJogo - 03.09.2016, 19:32
Re: OnPlayerWeaponShot - by Whoo - 03.09.2016, 19:42
Re: OnPlayerWeaponShot - by OtimoJogo - 03.09.2016, 20:15
Re: OnPlayerWeaponShot - by OtimoJogo - 04.09.2016, 14:29

Forum Jump:


Users browsing this thread: 1 Guest(s)