[FilterScript] Anti-Lag/Anti-Lead/MTA-Bullet Hit Sync System v0.1 (Weapon Damages Synced) - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Anti-Lag/Anti-Lead/MTA-Bullet Hit Sync System v0.1 (Weapon Damages Synced) (
/showthread.php?tid=417368)
Re: Anti-Lag/Anti-Lead/MTA-Bullet Hit Sync System v0.1 (Weapon Damages Synced) -
Riddick94 - 26.05.2018
Quote:
Originally Posted by Exhibit
Why are you using SetPlayerTeam? Can you explain the purpose ? thanks
|
All the players are in the same team. That's going to cause them unable to damage eachother unless you use SetPlayerHealth for custom damages purposes.
I am not too sure about the whole script if it actuallys works but this bit of code should do the custom damage:
pawn Code:
[line 144 of script]
/*Hit Calculates*/
new Float:armour; GetPlayerArmour(damagedid,armour);
if(armour < 1)
{
new Float:health; GetPlayerHealth(damagedid, health);
SetPlayerHealth(damagedid,health-amount);
lasthit[damagedid] = playerid;
return 1;
}
if(armour > 0)
{
if(armour < amount)
{
new Float:health; GetPlayerHealth(damagedid, health);
new Float:value = amount-armour;
SetPlayerArmour(damagedid,0);
SetPlayerHealth(damagedid,health-value);
lasthit[damagedid] = playerid;
return 1;
}
if(armour > amount)
{
SetPlayerArmour(damagedid,armour-amount);
lasthit[damagedid] = playerid;
return 1;
}
return 1;
}
And about my opinion of the script... is that really necessary to use 48 switch statements? That's just horrendous, I am worried about how much memory that script requires to be allocated.
What I would do to optimize it is create an array with animation names (since the library is the same for all of them) and based on the hit bodypart parameter in callback I would call a random (sizeof array) animation. Also to avoid playing animation at every hit on player I would use "GetTickCount" function.