26.05.2018, 21:48
I created a headshot system by the help of CELL_ but the it wasn't working in-game:-
Then added print statements to know the error and we camed to decision that Headpart was not being shooted and only part of body being shoot was 1, Please help me!
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) { /* new abc_string[128]; format(abc_string, 128, "OnPlayerGiveDamage(%d, %d, %.2f, %d, %d)", playerid, damagedid, amount, weaponid, bodypart); SendClientMessage(playerid, 0xFFFFFFFF, abc_string); SendClientMessage(damagedid, 0xFFFFFFFF, abc_string);*/ print("Callback called."); if(damagedid != INVALID_PLAYER_ID) // Check if the player taking the damage didn't just take damage from other sources { print("Damaged passed."); if(bodypart == 9 && weaponid == 34) // Check if it was the head that was shot and he was also shot with a sniper.. change 34 to weapon of ur choice { print("Bodypart, weapon passed."); if(GetPlayerState(damagedid) == PLAYER_STATE_SPAWNED) // Check if the player is actually spawned.. { print("Spawn check passed."); SetPlayerHealth(damagedid, 0.00); // Kill the player GameTextForPlayer(playerid, "HEAD SHOT!", 1000, 2); // Just aesthetics GameTextForPlayer(damagedid, "HEAD SHOT!", 1000, 2); // Just aesthetics } } } return 1; }