SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 14/02/2019, 01:27 AM   #1
Gabriel432135
Little Clucker
 
Join Date: Nov 2018
Posts: 19
Reputation: 0
Default O que está errado nesse código:

Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)

{
    if(issuerid != INVALID_PLAYER_ID && bodypart == 9) // If not self-inflicted
    {
        new
            infoString[128],
            weaponName[24],
            victimName[MAX_PLAYER_NAME],
            attackerName[MAX_PLAYER_NAME];

        GetPlayerName(playerid, victimName, sizeof (victimName));
        GetPlayerName(issuerid, attackerName, sizeof (attackerName));
        SetPlayerHealth(playerid, 0.0);

        GetWeaponName(weaponid, weaponName, sizeof (weaponName));

        format(infoString, sizeof(infoString), "%s Deu um tiro na cabeça de %s, usando %s", attackerName, victimName, weaponName);
        SendClientMessageToAll(AMARELO, infoString);
    }
//--------------------------------------------------------------------------------------------------------------------------------------------------
    if(issuerid != INVALID_PLAYER_ID && bodypart == 4) // If not self-inflicted
    {
        new
            infoString[128],
            weaponName[24],
            victimName[MAX_PLAYER_NAME],
            attackerName[MAX_PLAYER_NAME];

		new vida = GetPlayerHealth(playerid);

        GetPlayerName(playerid, victimName, sizeof (victimName));
        GetPlayerName(issuerid, attackerName, sizeof (attackerName));
  		SetPlayerHealth(playerid, vida - 40.0);

        GetWeaponName(weaponid, weaponName, sizeof (weaponName));

        format(infoString, sizeof(infoString), "%s Deu um tiro nas partes baixas de %s, usando %s", attackerName, victimName, weaponName);
        SendClientMessageToAll(AMARELO, infoString);
    }
    return 1;
Gabriel432135 is offline   Reply With Quote
Old 14/02/2019, 01:44 AM   #2
Felipealves
Big Clucker
 
Felipealves's Avatar
 
Join Date: Mar 2016
Location: Paraná
Posts: 199
Reputation: 5
Default Re: O que está errado nesse código:

Aquele velho jogo do adivinhe o erro hmm
__________________
Felipealves is offline   Reply With Quote
Old 14/02/2019, 01:44 AM   #3
JeffSantos2
Big Clucker
 
JeffSantos2's Avatar
 
Join Date: Sep 2013
Location: Curitiba-PR-BR
Posts: 63
Reputation: 11
Default Re: O que está errado nesse código:

Teste assim:

Code:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
		if(bodypart == 9 || bodypart == 4)
		{
			new infoString[128], weaponName[24], victimName[MAX_PLAYER_NAME], attackerName[MAX_PLAYER_NAME];
			GetPlayerName(playerid, victimName, sizeof (victimName));
			GetPlayerName(issuerid, attackerName, sizeof (attackerName));

			GetWeaponName(weaponid, weaponName, sizeof (weaponName));

			if(bodypart == 9) 
			{
				SetPlayerHealth(playerid, 0.0);
				format(infoString, sizeof(infoString), "%s Deu um tiro na cabeça de %s, usando %s", attackerName, victimName, weaponName);
			}
			else 
			{
				new Float:Vida;
				GetPlayerHealth(playerid, Vida);
				SetPlayerHealth(playerid, Vida - 40.0);
				format(infoString, sizeof(infoString), "%s Deu um tiro nas partes baixas de %s, usando %s", attackerName, victimName, weaponName);
			}
			SendClientMessageToAll(AMARELO, infoString);
    }
	return 1;
}
JeffSantos2 is online now   Reply With Quote
Old 15/02/2019, 07:14 PM   #4
Gabriel432135
Little Clucker
 
Join Date: Nov 2018
Posts: 19
Reputation: 0
Default Re: O que está errado nesse código:

JeffSantos2 eu dei uma arrumada nos erros, mas vlw! O princípio funcionou! +R
Gabriel432135 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] O que está errado nesse código: Gabriel432135 Português/Portuguese 2 10/02/2019 01:56 AM
[Ajuda] Oque está errado nesse código? Eleonum Português/Portuguese 4 19/05/2018 01:53 AM
[Ajuda] O que esta errado nesse codigo? Lorruan Português/Portuguese 2 03/11/2016 04:06 PM
[Ajuda] Oque está errado nesse código? 4G4M3N0M Português/Portuguese 15 06/11/2014 01:47 AM
[Ajuda] O Que Esta Errado Nesse Código ? Alisson Silva Alves Português/Portuguese 20 20/02/2014 05:47 PM


All times are GMT. The time now is 02:22 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.