How do I kick when player gives damage?
#1

Hi,
I would like to get some help on how do I kick when a player attacks another player?
I know I can use OnPlayerGiveDamage but how do I use it?
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage

And I can create it for you! :

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponidbodypart)
{
    new 
string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
    new 
weaponname[24];
    
GetPlayerName(playeridattackersizeof (attacker));
    
GetPlayerName(damagedidvictimsizeof (victim));
    
Kick(attacker);
    return 
1;

Haven't tested it but it may work! :P
Reply
#3

Quote:
Originally Posted by ChristolisTV
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage

And I can create it for you! :

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponidbodypart)
{
    new 
string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
    new 
weaponname[24];
    
GetPlayerName(playeridattackersizeof (attacker));
    
GetPlayerName(damagedidvictimsizeof (victim));
    
Kick(attacker);
    return 
1;

Haven't tested it but it may work! :P
If you don't know what is going on, don't even try to help someone.

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        Kick(playerid);
    }
    return 1;
}

// OR

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        Kick(issuerid);
    }
    return 1;
}
Reply
#4

Thanks for your help
Reply
#5

If you want an advice, do not use OnPlayerTakeDamage for this, otherwise a player could theoretically send a fake message and get another innocent player kicked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)