23.07.2018, 05:34
(
Последний раз редактировалось coool; 23.07.2018 в 05:35.
Причина: bump info
)
Quote:
Hello,
Take a look at OnPlayerGiveDamage... Check if the player who has took damage is a cop.. and then assign the cop a variable (so you can check if he is taking damage in /ar command.) Then put a timer after the timer ends reset the variable from the cop.. +rep |
Quote:
Take a look at OnPlayerGiveDamage/OnPlayerTakeDamage |
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart)
{
return 1;
}
Quote:
Check if the player who has took damage is a cop.. |
PHP код:
if (playerid == cop) //cop is the var in which you store player's faction.
Quote:
and then assign the cop a variable |
PHP код:
PlayerHasTakenDamage[playerid] = issuerid; //this variable must be globally declared.
Quote:
so you can check if he is taking damage in /ar command. |
PHP код:
CMD:ar(playerid, params[])
{
//All the check etc.
if (PlayerHasTakenDamage[playerid] == targetid) return SendClientMessage(playerid, -1, "You can not arrest him.");
}
Quote:
Then put a timer after the timer ends reset the variable from the cop.. |
PHP код:
//Go back to the callback.
public OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart)
{
if (playerid == cop) //previous code
{
PlayerHasTakenDamage[playerid] = issuerid;//Preivous code
SetTimerEx("ResetDmgVar", time, false, "i", playerid); //timer
}
return 1;
}
forward ResetDmgVar(playerid);
public ResetDmgVar(playerid)
{
PlayerHasTakenDamage[playerid] = -1; //variable reset
}
P.S You can only bump a thread after 24 hours.