Hitman Problem
#1

Hi all, i have a problem with hitman system. When players type /contract [id] to order a hit on some player and when i take the hit and kill the target, the player won't die, he is just laying on the ground with 0 hp freezed (he can not move) i don't know why. Can someone help me solve this problem? Here is code.

Note: I put this on onplayerdeath when hitman kills his target.
Код:
    if(PlayerInfo[killerid][pMember] == 17 || PlayerInfo[killerid][pLeader] == 17)
    {
    if( PlayerInfo[ playerid ][ pDatameta ] == 1)
    {
    GivePlayerMoney(killerid, PlayerInfo[ playerid ][ pHitmenCena ]);
    format( globalstring, sizeof( globalstring ), "{FFFFFF}Hitman %s je izvrsio svoju narudzbu %s i zaradio %d rsd.", ImeIgraca( killerid ), ImeIgraca( playerid ), PlayerInfo[ playerid ][ pHitmenCena ] );
    OrgPoruka(BRT, globalstring );
    format( string, sizeof( string ), "Ubijeni ste od strane HITMANA");
    SCM(playerid, COLOR_LIGHTRED, string );
    format( globalstring, sizeof( globalstring ), "|Hitman| %s je ubio: %s", ImeIgraca( killerid ), ImeIgraca( playerid ) );
    PosaljiAdminima(COLOR_LIGHTRED, globalstring);
    PlayerInfo[ playerid ][ pHitmenCena ] = 0;
    HitmanInfo[ killerid ][ GoChase ] = 0;
    HitmanInfo[ playerid ][ GetChased ] = 0;
    HitmanInfo[ playerid ][ GotHit ] = 0;
    PlayerInfo[ playerid ][ pDatameta ] = 0;
    WantedLevel[playerid] = 0;
    }
    }
Reply
#2

Are you checking that killerid is a valid player before using it? From the wiki (https://sampwiki.blast.hk/wiki/OnPlayerDeath)
Quote:

You MUST check whether 'killerid' is valid (not INVALID_PLAYER_ID) before using it in an array (or really anywhere), as it will cause the OnPlayerDeath script to crash (not the entire script). This is because INVALID_PLAYER_ID is defined as 65535, and if an array only has 'MAX_PLAYERS' elements, e.g. 500, you're trying to access an index that is above 499, which is out of bounds.

Код:
if(killerid != INVALID_PLAYER_ID)
{
// code here
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)