SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <a_samp> | |
| 2 | ||
| 3 | /*------------------------- | |
| 4 | HeadShot System by Peppe | |
| 5 | The faster implementation of a headshot system in SA:MP. | |
| 6 | This script requires the new version of SA:MP 0.3b. | |
| 7 | ||
| 8 | www.pawnoitalia.forumfree.it | |
| 9 | www.atlantisgaming.it | |
| 10 | -------------------------*/ | |
| 11 | ||
| 12 | #define TIMER_INTERVAL 150 | |
| 13 | ||
| 14 | new | |
| 15 | maxPlayers; | |
| 16 | ||
| 17 | public OnFilterScriptInit() | |
| 18 | {
| |
| 19 | maxPlayers = GetMaxPlayers(); | |
| 20 | SetTimer("CheckHeadShot", TIMER_INTERVAL, 1);
| |
| 21 | return 1; | |
| 22 | } | |
| 23 | ||
| 24 | public OnPlayerDeath(playerid, killerid, reason) | |
| 25 | {
| |
| 26 | if(GetPVarInt(playerid, "Headshotted") == 1) | |
| 27 | {
| |
| 28 | SetPVarInt(playerid, "Headshotted", 0); | |
| 29 | GameTextForPlayer(playerid, "~r~Headshotted", 3000, 3); | |
| 30 | GameTextForPlayer(killerid, "~r~Headshott", 3000, 3); | |
| 31 | } | |
| 32 | return 1; | |
| 33 | } | |
| 34 | ||
| 35 | forward CheckHeadShot(); | |
| 36 | public CheckHeadShot() | |
| 37 | {
| |
| 38 | new | |
| 39 | index; | |
| 40 | for(new playerid; playerid < maxPlayers; playerid++) | |
| 41 | {
| |
| 42 | if(IsPlayerConnected(playerid)) | |
| 43 | {
| |
| 44 | - | index = GetPlayerAnimationIndex(playerid); |
| 44 | + | if(GetPlayerWeapon(playerid) == 34) |
| 45 | - | if(index == 1173 || index == 1175 || index == 1177 || index == 1178) |
| 45 | + | {
|
| 46 | - | {
|
| 46 | + | index = GetPlayerAnimationIndex(playerid); |
| 47 | - | SetPVarInt(playerid, "Headshotted", 1); |
| 47 | + | if(index == 1173 || index == 1175 || index == 1177 || index == 1178) |
| 48 | - | SetPlayerHealth(playerid, 0); |
| 48 | + | {
|
| 49 | - | } |
| 49 | + | SetPVarInt(playerid, "Headshotted", 1); |
| 50 | SetPlayerHealth(playerid, 0); | |
| 51 | } | |
| 52 | } | |
| 53 | } | |
| 54 | } | |
| 55 | return 1; | |
| 56 | } |