SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/05/2020, 01:38 AM   #1
cipi89
Little Clucker
 
Join Date: Sep 2018
Posts: 30
Reputation: 3
Default weapon config help

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
cipi89 is offline   Reply With Quote
Old 07/05/2020, 09:41 AM   #2
Adamoneoone
Huge Clucker
 
Join Date: Sep 2014
Posts: 485
Reputation: 37
Default Re: weapon config help

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.
Adamoneoone is offline   Reply With Quote
Old 08/05/2020, 10:19 AM   #3
cipi89
Little Clucker
 
Join Date: Sep 2018
Posts: 30
Reputation: 3
Default Re: weapon config help

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
cipi89 is offline   Reply With Quote
Old 08/05/2020, 11:18 AM   #4
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,168
Reputation: 165
Default Re: weapon config help

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
__________________
Undead Wasteland Roleplay | Visit website
The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
jasperschellekens is offline   Reply With Quote
Old 08/05/2020, 08:11 PM   #5
cipi89
Little Clucker
 
Join Date: Sep 2018
Posts: 30
Reputation: 3
Default Re: weapon config help

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.
cipi89 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
Weapon-config.inc KAZUOHANAKO01 Scripting Help 1 28/04/2020 02:51 PM
weapon-config.inc HELP Filbert Scripting Help 6 03/01/2020 10:11 PM
Weapon-config Admireal Scripting Help 1 01/09/2019 12:53 AM
[Ajuda] weapon-config Tiu_DaColombia Português/Portuguese 0 05/08/2019 04:53 PM
weapon-config.inc crukk11 Scripting Help 24 20/05/2017 02:51 PM


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


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