Need Help.
#1

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    PlayerShotPlayer[issuerid][playerid] = 1;

    new Float:HP;
    GetPlayerHealth(playerid, HP);
    if(team[issuerid] != team[playerid])
    {
    if(weaponid == 4)
    {
        SetPlayerHealth(playerid, HP-35);
    }
    }

    if(team[issuerid] == TEAM_HUMAN)
    {
    if(pInfo[issuerid][pHumanClass] == KICKBACK || pInfo[issuerid][pVipKickBack] == 1 || pInfo[issuerid][pKickBackCoin])
    {
        if(team[playerid] == TEAM_ZOMBIE)
        {
        if(weaponid == 23 || weaponid == 25 || weaponid == 24 || weaponid == 34 || weaponid == 31)
        {
            new Float:x,Float:y,Float:z,Float:angle;
            GetPlayerFacingAngle(playerid,Float:angle);
            GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);

            SetPlayerVelocity(playerid,Float:x+0.1,Float:y+0.1,Float:z+0.2);
            SetPlayerFacingAngle(playerid,Float:angle);
        }
        }
    }
    }

    if(team[issuerid] == TEAM_HUMAN)
    {
    if(pInfo[issuerid][pHumanClass] == VIPSCOUT)
    {
        if(team[playerid] == TEAM_ZOMBIE)
        {
        if(weaponid == 34)
        {
            SetPlayerHealth(playerid, -0);
        }
        }
    }
    }

    if(team[issuerid] == TEAM_HUMAN)
    {
    if(pInfo[issuerid][pHumanClass] == SCOUT || pInfo[issuerid][pHumanClass] == HEAVYSHOTGUN || pInfo[issuerid][pHumanClass] == KICKBACK || pInfo[issuerid][pDamageShotgunCoin] == 1)
    {
        if(team[playerid] == TEAM_ZOMBIE)
        {
        if(weaponid == 34 || 25)
        {
            new Float:hp;
            GetPlayerHealth(playerid,hp);
            SetPlayerHealth(playerid, hp - 45);
        }
        }
    }
    }

    if(team[issuerid] == TEAM_HUMAN)
    {
    if(pInfo[issuerid][pDamageMP5Coin] == 1 || pInfo[issuerid][pDamageDeagleCoin] == 1)
    {
        if(team[playerid] == TEAM_ZOMBIE)
        {
        if(weaponid == 24 || 29)
        {
            new Float:hp;
            GetPlayerHealth(playerid,hp);
            SetPlayerHealth(playerid, hp - 45);
        }
        }
    }
    }

    if(team[issuerid] == TEAM_HUMAN)
    {
    if(pInfo[issuerid][pHumanClass] == SNIPER)
    {
        if(team[playerid] == TEAM_ZOMBIE)
        {
        if(weaponid == 34 && bodypart == 9)
        {
            SetPlayerHealth(playerid, -0);
            GameTextForPlayer(playerid, "~n~~r~HEADSHOT", 3000, 3);
            GameTextForPlayer(issuerid, "~n~~g~HEADSHOT", 3000, 3);
            new Float:x, Float:y, Float:z, Float:fDistance, hsMessage[90], KName[MAX_PLAYER_NAME], PName[MAX_PLAYER_NAME];
            GetPlayerPos(playerid, x, y, z);
            fDistance = GetPlayerDistanceFromPoint(issuerid, x, y, z);
            GetPlayerName(issuerid, KName, MAX_PLAYER_NAME);
            GetPlayerName(playerid, PName, MAX_PLAYER_NAME);
            format(hsMessage, sizeof(hsMessage), "{DC143C}%s has Headshotted {FFFFFF}%s{DC143C} from the distance of %0.2f", KName, PName, fDistance);
            SendClientMessageToAll(-1, hsMessage);
            pInfo[issuerid][pHeads]++;
        }
        }
    }
    }
    return 1;
}
Код:
[debug] Run time error 4: "Array index out of bounds"
[09:37:28] [debug]  Accessing element at index 65535 past array upper bound 999
[09:37:28] [debug] AMX backtrace:
[09:37:28] [debug] #0 00037108 in ?? (... <5 arguments>) at D:\123\gamemodes\zma.pwn:2508
[09:37:28] [debug] #1 000103a0 in public OnPlayerTakeDamage (playerid=0, issuerid=65535, Float:amount=4.95000, weaponid=54, bodypart=3) at C:\Documents and Settings\Admin\Desktop\Execute Compiler\include\YSI\y_hooks/impl.inc:2343
Reply
#2

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID// If not self-inflicted
    
{
        
PlayerShotPlayer[issuerid][playerid] = 1;
        new 
Float:HP;
        
GetPlayerHealth(playeridHP);
        if(
team[issuerid] != team[playerid])
        {
            if(
weaponid == 4)
            {
                
SetPlayerHealth(playeridHP-35);
            }
        }
        if(
team[issuerid] == TEAM_HUMAN)
        {
            if(
pInfo[issuerid][pHumanClass] == KICKBACK || pInfo[issuerid][pVipKickBack] == || pInfo[issuerid][pKickBackCoin])
            {
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    if(
weaponid == 23 || weaponid == 25 || weaponid == 24 || weaponid == 34 || weaponid == 31)
                    {
                        new 
Float:x,Float:y,Float:z,Float:angle;
                        
GetPlayerFacingAngle(playerid,Float:angle);
                        
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
                        
SetPlayerVelocity(playerid,Float:x+0.1,Float:y+0.1,Float:z+0.2);
                        
SetPlayerFacingAngle(playerid,Float:angle);
                    }
                }
               }
        }
        if(
team[issuerid] == TEAM_HUMAN)
        {
            if(
pInfo[issuerid][pHumanClass] == VIPSCOUT)
            {
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    if(
weaponid == 34)
                    {
                        
SetPlayerHealth(playerid, -0);
                    }
                }
            }
        }
        if(
team[issuerid] == TEAM_HUMAN)
        {
            if(
pInfo[issuerid][pHumanClass] == SCOUT || pInfo[issuerid][pHumanClass] == HEAVYSHOTGUN || pInfo[issuerid][pHumanClass] == KICKBACK || pInfo[issuerid][pDamageShotgunCoin] == 1)
            {
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    if(
weaponid == 34 || 25)
                    {
                        new 
Float:hp;
                        
GetPlayerHealth(playerid,hp);
                        
SetPlayerHealth(playeridhp 45);
                    }
                }
            }
        }
        if(
team[issuerid] == TEAM_HUMAN)
        {
            if(
pInfo[issuerid][pDamageMP5Coin] == || pInfo[issuerid][pDamageDeagleCoin] == 1)
            {
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    if(
weaponid == 24 || 29)
                    {
                        new 
Float:hp;
                        
GetPlayerHealth(playerid,hp);
                        
SetPlayerHealth(playeridhp 45);
                    }
                }
            }
        }
        if(
team[issuerid] == TEAM_HUMAN)
        {
            if(
pInfo[issuerid][pHumanClass] == SNIPER)
            {
                if(
team[playerid] == TEAM_ZOMBIE)
                {
                    if(
weaponid == 34 && bodypart == 9)
                    {
                        
SetPlayerHealth(playerid, -0);
                        
GameTextForPlayer(playerid"~n~~r~HEADSHOT"30003);
                        
GameTextForPlayer(issuerid"~n~~g~HEADSHOT"30003);
                        new 
Float:xFloat:yFloat:zFloat:fDistancehsMessage[90], KName[MAX_PLAYER_NAME], PName[MAX_PLAYER_NAME];
                        
GetPlayerPos(playeridxyz);
                        
fDistance GetPlayerDistanceFromPoint(issueridxyz);
                        
GetPlayerName(issueridKNameMAX_PLAYER_NAME);
                        
GetPlayerName(playeridPNameMAX_PLAYER_NAME);
                        
format(hsMessagesizeof(hsMessage), "{DC143C}%s has Headshotted {FFFFFF}%s{DC143C} from the distance of %0.2f"KNamePNamefDistance);
                        
SendClientMessageToAll(-1hsMessage);
                        
pInfo[issuerid][pHeads]++;
                       }            
                 }
             }    
        }
    }
    return 
1;

Reply
#3

thanks
Reply
#4

solved my problem too! thanks a lot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)