SA-MP Forums Archive
weapon config help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: weapon config help (/showthread.php?tid=675209)



weapon config help - cipi89 - 07.05.2020

When vehicle explodes near players take no damage from explosion or when they catch on fire with this code:
Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if(Killed[playerid] != 0) return 1;
	
    hsv[issuerid] = 0;

    if((weapon == WEAPON_CARPARK || weapon == WEAPON_HELIBLADES || weapon == WEAPON_VEHICLE_MINIGUN) && GangTeam[playerid] == 0)
    {
        hsv[issuerid] = 1;
	return 0;
    }
    return 1;
}
However when I delete all the code inside and leave just this

Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    return 1;
}
Damage is being taken normally, I have absolutely not a clue what is preventing the damage.
I tried to debug it, weapon ids that're supposed to damage player on explosion or when he's on fire are ID:54 and ID:37


Re: weapon config help - Adamoneoone - 07.05.2020

PHP Code:
return 0
is preventing the damage (the one under hsv[issuerid]). If i'm not mistaken it's explained already in the include's thread.


Re: weapon config help - cipi89 - 08.05.2020

Code:
if((weapon == WEAPON_CARPARK || weapon == WEAPON_HELIBLADES || weapon == WEAPON_VEHICLE_MINIGUN) && GangTeam[playerid] == 0)
I'm asking about FLAMETHROWER and EXPLOSION which aren't WEAPON_CARPARK, WEAPON_HELIBLADES, WEAPON_VEHICLE_MINIGUN.

Instead they're 37 and 51 if im not mistaken so why would code above prevent damage from weapon 37 or 51?

Thats what I'm asking


Re: weapon config help - jasperschellekens - 08.05.2020

Quote:
Originally Posted by cipi89
View Post
Code:
if((weapon == WEAPON_CARPARK || weapon == WEAPON_HELIBLADES || weapon == WEAPON_VEHICLE_MINIGUN) && GangTeam[playerid] == 0)
I'm asking about FLAMETHROWER and EXPLOSION which aren't WEAPON_CARPARK, WEAPON_HELIBLADES, WEAPON_VEHICLE_MINIGUN.

Instead they're 37 and 51 if im not mistaken so why would code above prevent damage from weapon 37 or 51?

Thats what I'm asking
Returning 0 will result in not receiving any damage. Since you only have return 0 under specific conditions it will only prevent damage there. Are you sure you didn't assign ID 51(explosion) as on of these? WEAPON_CARPARK, WEAPON_HELIBLADES, WEAPON_VEHICLE_MINIGUN


Re: weapon config help - cipi89 - 08.05.2020

Quote:
Originally Posted by jasperschellekens
View Post
Returning 0 will result in not receiving any damage. Since you only have return 0 under specific conditions it will only prevent damage there. Are you sure you didn't assign ID 51(explosion) as on of these? WEAPON_CARPARK, WEAPON_HELIBLADES, WEAPON_VEHICLE_MINIGUN
No sir I have not touched weapon-config.inc at all.

Also this isn't the whole code I have under the OnPlayerDamage there's bunch of other things, however it DOES NOT matter what is there under OnPlayerDamage the explosion and burning damage will not apply on the player.

I tried commenting out piece by piece of that public in order to see what part exactly causes the issue and was able to find none. And I can assure you none of the "return 0;" can possible cause it not to deal damage since its all blatant like this:

Code:
if(tdmTeam[playerid] == tdmTeam[issuerid] && issuerid != IPI) { return 0; }
This was just an example I have absolutely no complex code in there its just checking whether the players are in lobby or are same team so they shouldn't be able to deal damage to one another etc. etc.

On every single "return 0;" i have under that public I've also wrote a short message that would help me determine which one is causing it not to deal damage and no message is being shown as if no "return 0;" is being called.