[Help]How to fix error 025 function heading differs from prototype
#5

Do everyone (including yourself) a favor and learn how to not code terrily, read some tutorials (you had tons of redundant code, used if only instead of if-else / switch and you had no proper indentation, math mistakes (integer + float, works but is slower))

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    new 
Float:HP;
    
GetPlayerHealth(playeridHP);
    switch(
weaponid)
    {
        case 
4SetPlayerHealth(playeridHP-30.0);
        case 
22SetPlayerHealth(playeridHP-25.0);
        case 
32SetPlayerHealth(playeridHP-25.0);
        case 
28SetPlayerHealth(playeridHP-25.0);
        case 
30SetPlayerHealth(playeridHP-30.0);
        case 
31SetPlayerHealth(playeridHP-21.0);
        case 
34SetPlayerHealth(playeridHP-70.0);
        case 
29SetPlayerHealth(playeridHP-25.0);
        case 
25SetPlayerHealth(playeridHP-40.0);    
    }
    if(
isseruid != INVALID_PLAYER_ID)
    {
        if(
isValidWeaponForSpecialHit(weaponid))
        {
            switch(
bodypart)
            {
                case 
3sInfo[playerid][Chest] += 1;
                case 
4sInfo[playerid][Crotch] += 1;
                case 
5sInfo[playerid][LArm] += 1;
                case 
6sInfo[playerid][RArm] += 1;
                case 
7sInfo[playerid][LLeg] += 1;
                case 
8sInfo[playerid][RLeg] += 1;
                case 
9:
                {
                    
SetPlayerHealth(playeridHP-70.0);
                    
sInfo[playerid][Head] += 1;
                }
            }
        }
    }
}
isValidWeaponForSpecialHit(weaponid)
{
    return (
weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 || weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34);

Also, update your a_samp.inc which you can find in the package at http://www.sa-mp.com/download.php
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)