Damage!
#6

Quote:
Originally Posted by coool
Посмотреть сообщение
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
You just have to change the above from English Language to Pawn!
Quote:

Take a look at OnPlayerGiveDamage/OnPlayerTakeDamage

PHP код:
public OnPlayerTakeDamage(playeridissueridamountweaponidbodypart)
{
    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(playeridparams[])
{
    
//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(playeridissueridamountweaponidbodypart)
{
    if (
playerid == cop//previous code
    
{
        
PlayerHasTakenDamage[playerid] = issuerid;//Preivous code
        
SetTimerEx("ResetDmgVar"timefalse"i"playerid); //timer
    
}
    return 
1;
}
forward ResetDmgVar(playerid);
public 
ResetDmgVar(playerid)
{
    
PlayerHasTakenDamage[playerid] = -1//variable reset 

Quote:
Originally Posted by Thanks
Посмотреть сообщение
Can you give me example code? Ty
Shown It.

P.S You can only bump a thread after 24 hours.
Reply


Messages In This Thread
Damage! - by Thanks - 22.07.2018, 01:19
Re: Damage! - by coool - 22.07.2018, 06:18
Re: Damage! - by Thanks - 22.07.2018, 16:02
Re: Damage! - by Thanks - 23.07.2018, 02:03
Re: Damage! - by Thanks - 23.07.2018, 04:26
Re: Damage! - by coool - 23.07.2018, 05:34

Forum Jump:


Users browsing this thread: 1 Guest(s)