SA-MP Forums Archive
OnPlayerDeath - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath (/showthread.php?tid=379652)



OnPlayerDeath - CrazyChoco - 22.09.2012

Well Hello Guys, I wanna to make it like when TEAM_COP, do kill TEAM_CIVIL the 3rd time he will get kicked from the server, but i dont know how to do it with the 3rd time, anyone knows it? If its bad explained ill explain it better


Re: OnPlayerDeath - CrazyChoco - 22.09.2012

Is it unclear?


Re: OnPlayerDeath - MarTaTa - 22.09.2012

You mean if a cop kill civilian 3 times he got kicked ?
If yes use a variable and OnplayerDeath edit it


Re: OnPlayerDeath - CrazyChoco - 22.09.2012

Yea, you know what i meaned But i dunno how to do it


Re: OnPlayerDeath - CrazyChoco - 22.09.2012

Does someone knows the variable?


Re: OnPlayerDeath - TaLhA XIV - 22.09.2012

You have to do it like make a variable and add 1 point to it when ever a player kills a civilian,and when it reaches to 3 he get's kicked simple.Use a timer that keeps on checking player's points.and example of adding
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerTeam(playerid) == TEAM_CIVIL)
    {
        PlayerInfo[killerid][point] += 1;
        if(PlayerInfo[killerid][point] == 3)return Kick(killerid);
    }
    return 1;
}
This is an example not tested and tell me if something goes wrong.


Re: OnPlayerDeath - CrazyChoco - 22.09.2012

so this is when Cop or other teams shoot civil 3 times he will get kicked?


Re: OnPlayerDeath - SKAzini - 22.09.2012

pawn Код:
new TimesCopKilledCivilian[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    TimesCopKilledCivilian[playerid] = 0;
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[playerid] == TEAM_CIVIL)
    {
        if(gTeam[killerid] == TEAM_COP)
        {
            if(TimesCopKilledCivilian[killerid] != 3)
            {
                TimesCopKilledCivilian[killerid] += 1;
            }
            else Kick(killerid);
        }
    }
    return 1;
}
That would do it if you have gTeam.


Re: OnPlayerDeath - CrazyChoco - 22.09.2012

Works ThanZ Rep for sure