Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
- {
- if(damagedid != INVALID_PLAYER_ID)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;
- if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID) return 1;
- if(PlayerInfo[playerid][pDamageInformer] > 0) {
- new str[128];
- format(str, sizeof(str), "~g~%.0f", amount);
- GameTextForPlayer(playerid, str, 1500, 3);
- }
- if(amount < 0)
- {
- new string[128],sendername[25];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- format(string,sizeof(string),"{f03337}Warning: %s (%d) it is possible to use global kill, health amount given: %.2f.",sendername,playerid,amount);
- ABroadCast(COLOR_WHITE,string,1);
- KickEx(playerid);
- return 1;
- }
- if(playerdeath[damagedid] == 0)
- {
- if(weaponid == 34)
- {
- SetPlayerHealthEx(damagedid, 0.0);
- SetPlayerArmourEx(damagedid, 0.0);
- OnPlayerDeath(damagedid,playerid,weaponid);
- playerdeath[damagedid] = 1;
- return 1;
- }
- new Float: HP[MAX_PLAYERS], Float: AP[MAX_PLAYERS], Float:remainHP[MAX_PLAYERS];
- GetPlayerHealthEx(damagedid,HP[damagedid]);
- GetPlayerArmourEx(damagedid,AP[damagedid]);
- if ( AP[damagedid] >= amount )
- {
- SetPlayerArmourEx ( damagedid, AP[damagedid] - amount );
- }
- else if ( AP[damagedid] <= 0 )
- {
- remainHP[damagedid] = HP[damagedid] - amount;
- SetPlayerHealthEx ( damagedid, remainHP[damagedid] );
- if ( remainHP[damagedid] <= 0 )
- {
- OnPlayerDeath( damagedid, playerid, weaponid );
- playerdeath[damagedid] = 1;
- return 1;
- }
- }
- else
- {
- remainHP[damagedid] = HP[damagedid] + ( AP[damagedid] - amount );
- SetPlayerArmourEx ( damagedid, 0.0 );
- SetPlayerHealthEx ( damagedid, remainHP[damagedid] );
- if ( remainHP[damagedid] <= 0 )
- {
- OnPlayerDeath( damagedid, playerid, weaponid );
- playerdeath[damagedid] = 1;
- return 1;
- }
- }
- if(pingsound[playerid] == 1)
- {
- PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
- }
- if(PlayerCuffed[damagedid] == 1)
- {
- SetPlayerHealthEx(damagedid,100);
- }
- if(PlayerInfo[damagedid][pSleeping] == 1)
- {
- SetPlayerHealthEx(damagedid, 100);
- }
- new string[128], weapon[128];
- GetWeaponName(GetPlayerWeapon(playerid), weapon, 128);
- format(string, sizeof(string), "Damage given: %s (%d) - %s - %.1f damage", GetName(damagedid), damagedid, weapon, amount);
- foreach(Player, i) {
- if(dmg[i] == playerid)
- SendClientMessage(i, COLOR_GRAD1, string);
- }
- if(tazer[playerid] == 1 && IsACop(playerid) && weaponid == 24)
- {
- SetPlayerHealthEx(damagedid, 100);
- if(IsACop(damagedid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You cannot taze cops.");
- if(PlayerCuffed[damagedid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This player is already tazed.");
- if(PlayerInfo[damagedid][pSleeping] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Player is AFK.");
- if(GetDistanceBetweenPlayers(playerid,damagedid) < 15)
- {
- new sendername[25],giveplayer[25];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- GetPlayerName(damagedid,giveplayer,sizeof(giveplayer));
- format(string, sizeof(string), "* You were Tazed by %s for 8 seconds.", sendername);
- SendClientMessage(damagedid, COLOR_LIGHTBLUE, string);
- format(string, sizeof(string), "* You Tazed %s for 8 seconds.", giveplayer);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
- format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- GameTextForPlayer(damagedid, "~r~~h~Tazed", 2500, 3);
- TogglePlayerControllable(damagedid, 0);
- PlayerCuffed[damagedid] = 1;
- PlayerCuffedTime[damagedid] = 8;
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment