11.12.2011, 07:46
Hi there, can anyone explain to me why this callback isn't allowing damage to go through under the following circumstances?
I realise it's not a very efficient way of coding.
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
new playername[24], string[128];
GetPlayerName(playerid, playername, 24);
if(damagedid != INVALID_PLAYER_ID && CoolDownTime[playerid] == 0)
{
if(gTeam[playerid] == TEAM_POLICE && gTeam[damagedid] == TEAM_CIVILIAN)
{
if(GetPlayerWantedLevel(damagedid) == 0 && Warning[playerid] <= 2)
{
format(string, sizeof(string), "%s[%d] has been warned by auto-admin. Reason: Attacking innocent players.", playername, playerid);
SendClientMessageToAll(COLOR_ADMIN, string);
CoolDownTime[playerid] = 1;
SetTimer("CoolDownTimer", 10000, 0);
Warning[playerid]++;
}
}
}
if(damagedid != INVALID_PLAYER_ID && CoolDownTime[playerid] == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN && gTeam[damagedid] == TEAM_POLICE)
{
if(GetPlayerWantedLevel(playerid) >= 0 && GetPlayerWantedLevel(playerid) <= 5)
{
SendClientMessage(playerid, COLOR_WANTED, "Your wanted level has increased.");
CoolDownTime[playerid] = 1;
SetTimer("CoolDownTimer", 10000, 0);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) +1);
}
}
}
return 1;
}