SA-MP Forums Archive
Confused - 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: Confused (/showthread.php?tid=588332)



Confused - Stev - 07.09.2015

Hello,

I'm either being retarded or there's error in my script somewhere. But when ever a player shots another player with any gun/weapon do damage is given. Do I have to add each weapon and damage to "OnPlayerGiveDamage" or "OnPlayerTakeDamage"? I.m kinda confused :S


Re: Confused - brandypol - 07.09.2015

you can download a filterscript that will make players loose health when they gets shots


Re: Confused - Stev - 07.09.2015

I never use filterscripts. Don't see the point in them.


Re: Confused - brandypol - 07.09.2015

than you can add that to your script :

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID// If not self-inflicted
    
{
        new
            
infoString[128],
            
weaponName[24],
            
victimName[MAX_PLAYER_NAME],
            
attackerName[MAX_PLAYER_NAME];
 
        
GetPlayerName(playeridvictimNamesizeof (victimName));
        
GetPlayerName(issueridattackerNamesizeof (attackerName));
 
        
GetWeaponName(weaponidweaponNamesizeof (weaponName));
 
        
format(infoStringsizeof(infoString), "%s has made %.0f damage to %s, weapon: %s"attackerNameamountvictimNameweaponName);
        
SendClientMessageToAll(-1infoString);
    }
    return 
1;




Re: Confused - Stev - 07.09.2015

I have already tried this, but somehow the victim dosen't loss any health what so ever


Re: Confused - brandypol - 07.09.2015

do you have any errors when you compile ?


Re: Confused - Sjn - 07.09.2015

For me, It's more likely you have SetPlayerTeam used to set players in same team? If they are in same team, they won't be able to hit each other.


Re: Confused - Stev - 07.09.2015

Nope, No errors at all.
EDIT: I have SetPlayerTeam(..) For all my classes at different numbers, Civilian: 1 Police: 2 and so on.

EDIT 2: It was SetPlayerTeam(..), but I had it so Civilians cant kill each other some how..

EDIT 3: Fixed.