Код:
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(amount < 0)
{
new string[256],sendername[25];
GetPlayerName(playerid,sendername,sizeof(sendername));
format(string, sizeof(string), "(N) %s (%d, level %d) can use global kill, damage: %.2f.",sendername, playerid, PlayerInfo[playerid][pLevel], amount);
ABroadCast(COLOR_RED,string,1);
return 1;
}
if(PlayerInfo[playerid][pPaintBallG] > 0)
{
PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
}
new fpm,fkm;
fpm = PlayerInfo[playerid][pMember];
fkm = PlayerInfo[damagedid][pMember];
for(new turf = 1; turf < sizeof(TurfInfo); turf++)
{
if(IsPlayerInTurf(playerid, turf) && IsPlayerInTurf(damagedid, turf))
{
if(IsAMember(playerid) && IsAMember(damagedid))
{
if(WarInfo[turf][wFaction] == fpm && WarInfo[turf][wAttacker] == fkm || WarInfo[turf][wFaction] == fkm && WarInfo[turf][wAttacker] == fpm)
{
PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
}
}
}
}
if(PlayerInfo[damagedid][pPaintBallG] > 0)
{
if(paintrs[PlayerInfo[damagedid][pPaintBallG]] > 0)
{
SetPlayerHealthEx(damagedid, 100.0);
}
}
if(playerdeath[damagedid] == 0)
{
if(weaponid == 34 && PlayerInfo[damagedid][pPaintBallG] < 1)
{
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,100);
}
if(PlayerInfo[damagedid][pSleeping] == 1)
{
SetPlayerHealthEx(damagedid, 100);
}
if(tazer[playerid] == 1 && IsACop(playerid) && weaponid == 24)
{
if(IsACop(damagedid)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Cannot Tazer Cops/FBI/National Guard.");
if(PlayerCuffed[damagedid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Player already tazed.");
if(PlayerInfo[damagedid][pSleeping] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Player is on sleeping.");
if(GetDistanceBetweenPlayers(playerid,damagedid) < 15)
{
new string[126],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;
SetPlayerHealthEx(damagedid,100);
}
}
}
}
return 1;
}
This is just a thing to try.If that works we have to modify the part of that code to make it in logic of script's structure.