SA-MP Forums Archive
Need help Bro Pro. - 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: Need help Bro Pro. (/showthread.php?tid=591218)



Need help Bro Pro. - MBilal - 09.10.2015

Код:
I am using this under OnPlayerTakeDamage.
					    new Float:HP,Float:A;
						GetPlayerHealth(playerid, HP);
						GetPlayerArmour(playerid,A);
						if(A >  0.0)
						{
							switch(weaponid)
							{
							case 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,42: SetPlayerArmour(playerid, A-amount);
							}
						}
						if(A <= 0.0)
						{
						    switch(weaponid)
							{
						    case 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,42: SetPlayerHealthEx (playerid, HP-amount);
							}
						}
The problem which i am getting is it refill armour or health rather than decreasing it.. Also player getting damage in Health before Armour..... why ?

Код:
SetPlayerHealthEx(playerid,Float:NewHealth)
{
	new Float:A;
	GetPlayerArmour(playerid,A);
	if(NewHealth > 99 && A <= 0.0 && JustSpawned[playerid] == 0 && onduty[playerid] == 0 && pInfo[playerid][GodMode] == 0 ) NewHealth = 99;
	if(NewHealth <= 0.0) NewHealth = 0.0;
	return SetPlayerHealth(playerid,NewHealth);
}
The armour is decrease then increase same with health .

Kindly Help me to fix that Thanks.


Re: Need help Bro Pro. - AbyssMorgan - 09.10.2015

PHP код:
SetPlayerHealthEx(playerid,Float:NewHealth)
{
    new 
Float:A;
    
GetPlayerArmour(playerid,A);
    if((
NewHealth 99 && <= 0.0) && JustSpawned[playerid] == && onduty[playerid] == && pInfo[playerid][GodMode] == NewHealth 99;
    if(
NewHealth <= 0.0NewHealth 0.0;
    return 
SetPlayerHealth(playerid,NewHealth);

Invalid range in if

Example:
(a > 0 && a < 99 && b == 5) //invalid
((a > 0 && a < 99) && b == 5) //valid


Re: Need help Bro Pro. - MBilal - 09.10.2015

The problem what i getting when some budy shoot some one he fist lose armour ammount then he get that amount..
I dont want he get that ammount...