Advertisement
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(togding[playerid] == 0) PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;
- if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID) return 1;
- new string[180];
- if(playerDeath[damagedid] == 0) {
- foreach(Player, i) {
- if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) {
- if(Spectate[i] == damagedid || Spectate[i] == playerid) {
- new victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
- new weaponname[24];
- GetPlayerName(playerid, attacker, sizeof (attacker));
- GetPlayerName(damagedid, victim, sizeof (victim));
- GetWeaponName(weaponid, weaponname, sizeof (weaponname));
- if(weaponid == 0) weaponname = "Fist";
- format(string, sizeof(string), "[DMG] %s did %.0f damage to %s using weapon %s.", attacker, amount, victim, weaponname);
- SCM(i, 0xFFADADFF, string);
- }
- }
- }
- }
- if(amount < 0) {
- format(string, sizeof(string), "AdmWarning: %s(%d) este suspectat de global kill. (damage: %.2f)",GetName(playerid),playerid,amount);
- if(GetPVarInt(playerid, "Cover") == 0) SendAdminMessage(COLOR_WARNING, string,1);
- KickEx(playerid);
- return 1;
- }
- for(new sf = 0; sf < MAX_SAFEZONES; sf++) {
- if(SafeZone[sf][szRange] >= 15) {
- if(PlayerToPoint(SafeZone[sf][szRange], playerid, SafeZone[sf][szX], SafeZone[sf][szY], SafeZone[sf][szZ])) {
- if(!IsPlayerInAnyVehicle(playerid) && !IsACop(playerid) && PlayerHit[playerid] != damagedid && PaintType[playerid] == 0 && InWar[PlayerInfo[playerid][pMember]] == 0) {
- SCM(playerid, COLOR_LIGHTRED, "Ai primit freeze timp de 5 secunde deoarece ai lovit pe cineva intr-o zona protejata.");
- TogglePlayerControllable(playerid, 0);
- SetTimerEx("UnFreezeStation", 5000, false, "i", playerid);
- SetPlayerArmedWeapon(playerid, 0);
- }
- }
- }
- }
- if(playerDeath[damagedid] == 0) {
- if(tazer[playerid] == 1 && IsACop(playerid) && weaponid == 24) {
- if(IsACop(damagedid)) return SCM(playerid, COLOR_WHITE, "Acel jucator este intr-un departament de politie..");
- if(PlayerCuffed[damagedid] == 1) return SCM(playerid, COLOR_WHITE, "Acel jucator este deja electrocutat.");
- if(PlayerInfo[damagedid][pSleeping] == 1) return SCM(playerid, COLOR_WHITE, "Acel jucator doarme.");
- if(GetDistanceBetweenPlayers(playerid, damagedid) < 15) {
- format(string, sizeof(string), "* %s tazed %s for 8 seconds.", GetName(playerid), GetNameEx(damagedid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- TogglePlayerControllable(damagedid, 0);
- PlayerCuffed[damagedid] = 1;
- PlayerCuffedTime[damagedid] = 8;
- return 1;
- }
- }
- if(PlayerInfo[playerid][pMember] == PlayerInfo[damagedid][pMember] && InWar[PlayerInfo[playerid][pMember]] == 1) {
- new Float: HP;
- GetPlayerHealthEx(damagedid,HP);
- SetPlayerHealthEx(damagedid, HP);
- return 1;
- }
- if(InGame[playerid] == 1 && InGame[damagedid] == 1) {
- if(Team[playerid] == Team[damagedid]) {
- new Float: HP;
- GetPlayerHealthEx(damagedid,HP);
- SetPlayerHealthEx(damagedid, HP);
- return 1;
- }
- }
- if(weaponid == 34) {
- SetPlayerHealthEx(damagedid, 0.0);
- SetPlayerArmourEx(damagedid, 0.0);
- OnPlayerDeath(damagedid,playerid,weaponid);
- playerDeath[damagedid] = 1;
- return 1;
- }
- new Float: HP, Float: AP ;
- GetPlayerHealthEx(damagedid,HP);
- GetPlayerArmourEx(damagedid,AP);
- if(AP >= amount) SetPlayerArmourEx (damagedid, AP - amount);
- else if(AP <= 0) {
- new const Float: remainHP = HP - amount;
- SetPlayerHealthEx(damagedid, remainHP);
- if( remainHP <= 0 ) {
- OnPlayerDeath(damagedid, playerid, weaponid);
- playerDeath[damagedid] = 1;
- return 1;
- }
- }
- else {
- new const Float: remainHP = HP + (AP - amount);
- SetPlayerArmourEx(damagedid, 0.0);
- SetPlayerHealthEx(damagedid, remainHP);
- if( remainHP <= 0 )
- {
- OnPlayerDeath(damagedid, playerid, weaponid);
- playerDeath[damagedid] = 1;
- return 1;
- }
- }
- if(PlayerCuffed[damagedid] == 1) SetPlayerHealthEx(damagedid, 99);
- if(PlayerInfo[damagedid][pSleeping] == 1) SetPlayerHealthEx(damagedid, 99);
- if(DMGTimer[damagedid] != 0) {
- Combo[playerid] ++;
- KillTimer(DMGTimer[damagedid]);
- KillTimer(DMGTimer[playerid]);
- }
- else Combo[playerid] = 0;
- new weapon[180];
- if(GetPlayerWeapon(playerid) == 0) weapon ="Fist";
- else GetWeaponName(weaponid, weapon, sizeof (weapon));
- if(PlayerInfo[damagedid][pShowDMG] == 1 && GetPVarInt(playerid, "Undercover") == 0) {
- if(Combo[playerid] != 0) format(string, sizeof(string), "%s~n~-%0.1f HP with %s (%dx)", GetName(playerid), amount, weapon, Combo[playerid]+1);
- else format(string, sizeof(string), "%s~n~-%0.1f HP with %s", GetName(playerid), amount, weapon);
- PlayerTextDrawSetString(damagedid, DMGTD[0], string);
- PlayerTextDrawShow(damagedid, DMGTD[0]);
- }
- DMGTimer[damagedid] = SetTimerEx("DamageInformer", 2000, false, "i", damagedid);
- if(PlayerInfo[playerid][pShowDMG] == 1) {
- if(Combo[playerid] != 0) format(string, sizeof(string), "%s~n~+%0.1f HP with %s (%dx)", GetName(damagedid), amount, weapon, Combo[playerid]+1);
- else format(string, sizeof(string), "%s~n~+%0.1f HP with %s", GetName(damagedid), amount, weapon);
- PlayerTextDrawSetString(playerid, DMGTD[1], string);
- PlayerTextDrawShow(playerid, DMGTD[1]);
- DMGTimer[playerid] = SetTimerEx("DamageInformer", 2000, false, "i", playerid);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement