SA-MP Forums Archive
Problem with 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: Problem with onplayerdeath (/showthread.php?tid=313927)



Problem with onplayerdeath - Face9000 - 27.01.2012

Hello,i've maked this code OnPlayerDeath.

pawn Код:
if(gTeam[killerid] == TEAM_CIV && gTeam[playerid] == TEAM_COP)
    {
    new plwl = GetPlayerWantedLevel(killerid);
    plwl = GetPlayerWantedLevel(killerid);
    SetPlayerWantedLevel(killerid,plwl +6);
    new string2[135];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string2, sizeof(string2), "- MURDER - You have murdered %s (%d) - Wanted Level: %d",pname,playerid,plwl);
    SendClientMessage(killerid,red,string2);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    new current_zone;
    current_zone = player_zone[i];
    if(gTeam[playerid] == TEAM_COP)
    {
    new copmsg[170];
    new kname[MAX_PLAYER_NAME];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(kname));
    GetPlayerName(killerid, kname, sizeof(kname));
    format(copmsg, sizeof(copmsg), "- WARNING ALL COPS: %s (%d) murdered %s (%d) at %s",kname,killerid,name,playerid,zones[current_zone][zone_name]);
    SendClientMessage(i, COLOR_BLUE, copmsg);
    }
    }
    }
Everything works fine,except one thing.

The "WARNING ALL COPS etc" need to show ONLY at TEAM_COP and not to TEAM_CIV.

How to fix this?


Re: Problem with onplayerdeath - Jefff - 27.01.2012

if(gTeam[i] == TEAM_COP)


Re: Problem with onplayerdeath - Face9000 - 27.01.2012

Nope,doesn't work.


Re: Problem with onplayerdeath - Scenario - 27.01.2012

pawn Код:
if(gTeam[killerid] == TEAM_CIV && gTeam[playerid] == TEAM_COP)
Are those statements being met? Again, use some prints to assist in debugging your code. It will help narrow down where the problem is occurring, believe me!


Re: Problem with onplayerdeath - Face9000 - 28.01.2012

Now it works,thanks.