[Pedido] Sniper mata em 1 tiro
#7

Quote:
Originally Posted by WagnerSantosTexudo
Посмотреть сообщение
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(weaponid == WEAPON_SNIPER)
    {
          	new Float:Life;
		GetPlayerHealth(playerid,health);
		SetPlayerHealth(damageid,Life - 100);
    }
    return 1;
}
assim ? ta certo?
Em se tratando de programaзгo, sim, parcialmente!
Digo isso porque cada um usa seu raciocнnio (lуgica) para chegar a um objetivo, porйm com um algoritmo diferente.
No seu cуdigo, vc usou playerid onde o correto й damagedid.

Dentro desta condicional, precisamos ainda criar outra, para verificar o colete:
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(weaponid == WEAPON_SNIPER)
    {
		new Float:Colete, Float:Vida;
		
		GetPlayerArmour(damagedid, Colete);
		
		if(Colete > 0)
		{
			GetPlayerHealth(damagedid, Vida);
			
			SetPlayerArmour(damagedid, 0.0);
			
			SetPlayerHealth(damagedid, Vida - 50);
		}
		else
		{
			SetPlayerHealth(damagedid, 0.0);
		}
    }
    return 1;
}
Reply


Messages In This Thread
Sniper mata em 1 tiro - by WagnerSantosTexudo - 08.09.2016, 19:43
Re: Sniper mata em 1 tiro - by Ever_SH - 08.09.2016, 19:47
Re: Sniper mata em 1 tiro - by F1N4L - 08.09.2016, 19:48
Re: Sniper mata em 1 tiro - by WagnerSantosTexudo - 08.09.2016, 19:52
Re: Sniper mata em 1 tiro - by F1N4L - 08.09.2016, 19:54
Re: Sniper mata em 1 tiro - by WagnerSantosTexudo - 08.09.2016, 20:03
Re: Sniper mata em 1 tiro - by F1N4L - 08.09.2016, 20:15

Forum Jump:


Users browsing this thread: 1 Guest(s)