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



Wep dmg - xxxDeathxxx - 06.12.2012

hello

I have added FS wich give for sniper 100dmg, so one hit, and human is death.

Question how i can add that dmg for Noose snipers and hitman snipers only?
so people cant abuse that in rp`?


Re: Wep dmg - Shockey HD - 06.12.2012

Show us some code in order to help you.

Though it will look something like this


Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
    {
	if(Noose Faction Varaible || Hitman Faction Variable)
	{
	 	SetPlayerHealth(playerid, 0.0);
	}
    }
    return 1;
}



Re: Wep dmg - RajatPawar - 06.12.2012

You can create a variable, make the damage 100 only if variable is 1, set variable 1 if player chooses class as hitman and for others, set it to 0.


Re: Wep dmg - xxxDeathxxx - 06.12.2012

OKAY, i will show come , soon, if i get my battery full another laptop


Re: Wep dmg - RajatPawar - 06.12.2012

Add this to the top of your script.
pawn Код:
new isdmgsniper[MAX_PLAYERS]=0;
Then:
pawn Код:
public OnPlayerSpawn(playerid)
{
         new skinid = GetPlayerSkin(playerid);
         if(skinid==17)
         {
             isdmgsniper[playerid]=1;
         }
         else isdmgsniper[playerid]=0;
   return 1;
}
Add this above the line (if issuerid....)
pawn Код:
if (isdmgsniper[playerid]==1)
So now, if player chooses skin:

his one sniper hit will result in a 100 pcnt health loss, or for other skins, it wont.


Re: Wep dmg - xxxDeathxxx - 06.12.2012

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Add this to the top of your script.
pawn Код:
new isdmgsniper[MAX_PLAYERS]=0;
Then:
pawn Код:
public OnPlayerSpawn(playerid)
{
         new skinid = GetPlayerSkin(playerid);
         if(skinid==17)
         {
             isdmgsniper[playerid]=1;
         }
         else isdmgsniper[playerid]=0;
   return 1;
}
Add this above the line (if issuerid....)
pawn Код:
if (isdmgsniper[playerid]==1)
So now, if player chooses skin:

his one sniper hit will result in a 100 pcnt health loss, or for other skins, it wont.
how to make fs with that? just do like you said in my fs?


Re: Wep dmg - RajatPawar - 06.12.2012

You dont need to 'make fs' with that, just add my code into your code (your FS).


Re: Wep dmg - xxxDeathxxx - 06.12.2012

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Show us some code in order to help you.

Though it will look something like this


Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
    {
	if(Noose Faction Varaible || Hitman Faction Variable)
	{
	 	SetPlayerHealth(playerid, 0.0);
	}
    }
    return 1;
}
i got this error
Quote:

wdmg.pwn(40) : error 029: invalid expression, assumed zero




Re: Wep dmg - xxxDeathxxx - 06.12.2012

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Add this to the top of your script.
pawn Код:
new isdmgsniper[MAX_PLAYERS]=0;
Then:
pawn Код:
public OnPlayerSpawn(playerid)
{
         new skinid = GetPlayerSkin(playerid);
         if(skinid==17)
         {
             isdmgsniper[playerid]=1;
         }
         else isdmgsniper[playerid]=0;
   return 1;
}
Add this above the line (if issuerid....)
pawn Код:
if (isdmgsniper[playerid]==1)
So now, if player chooses skin:

his one sniper hit will result in a 100 pcnt health loss, or for other skins, it wont.
I cant understand about this one, how to add it to fs