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



Help OnPlayerShootPlayer - nastasescu - 22.12.2013

I've this https://sampforum.blast.hk/showthread.php?pid=937824#pid937824
And I type in my script
Код:
{
public OnPlayerShootPlayer(shooter,target,Float:damage)
    new Float:H[2];
    GetPlayerHealth(target, H[0]);
    GetPlayerArmour(target,H[1]);
    if(GetPlayerWeapon(shooter) == 34)
    {
        if(H[1] > 0) return SetPlayerArmour(target,0);
        SetPlayerHealth(target, H[0]-100);
    }
    return 1;
}
I have the define etc.
The error is: G:\SAMP TESTE\pawno\zyghy.pwn(2431) : error 025: function heading differs from prototype


Re: Help OnPlayerShootPlayer - CutX - 22.12.2013

that "{" above your public should be under it.

and also, its: OnPlayerShootPlayer(Shooter,Target,Float:HealthLos t,Float:ArmourLost)
not OnPlayerShootPlayer(shooter,target,Float:damage)


PHP код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    new 
Float:H[2];//u dont need that, you can use HealthLost and ArmorLost
    
GetPlayerHealth(targetH[0]);
    
GetPlayerArmour(target,H[1]);
    if(
GetPlayerWeapon(shooter) == 34)
    {
        if(
H[1] > 0) return SetPlayerArmour(target,0);
        
SetPlayerHealth(targetH[0]-100);
    }
    return 
1;




AW: Help OnPlayerShootPlayer - Nero_3D - 22.12.2013

Quote:
Originally Posted by wups
Посмотреть сообщение
EDIT 2013: THIS INCLUDE IS OLD AND OUTDATED! SA-MP HAS DEVELOPED NATIVE FUNCTIONS FOR THIS.
OnPlayerTakeDamage
OnPlayerGiveDamage