Need some help.
#1

This is a simple code but I would like to know how to make it so when they /kill they don't lose the $500.
Is this possible?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendClientMessage(killerid, COLOR_GREY, " You're now a murder! ");
    GivePlayerMoney(killerid, 500);
    SendClientMessage(playerid, COLOR_GREY, " You have been murdered! ");
    GivePlayerMoney(playerid, -500);
    return 1;
}
Reply
#2

Could you please provide your /kill command?
Reply
#3

Yes it is possible heres a copy of mine however this won't work for you.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == Team_Cop && GetPlayerWantedLevel(playerid) == 0)
    {
        SetPVarInt(playerid,"KickOnKill",GetPVarInt(playerid,"KickOnKill")+1);
        PlayerInfo[playerid][pDeaths] ++;
        PlayerInfo[killerid][pKills] ++;
        SendDeathMessage(killerid, playerid, reason);
        return 1;
    }
    if(gTeam[playerid] == Team_Cop && gTeam[killerid] == Team_Cop)
    {
        JailPlayer(playerid,1);
        PlayerInfo[playerid][pDeaths] ++;
        PlayerInfo[killerid][pKills] ++;
        SendDeathMessage(killerid, playerid, reason);
        return 1;
    }
    if(gTeam[playerid] == Team_Civil && HasLifeInsurance[playerid] == false)
    {
        new Rand = random(100000);
Safe_GivePlayerMoney(playerid, -(Rand));
        new Insurance[128];
        format(Insurance,sizeof(Insurance),"~n~~r~Paid Medical Fees~n~~n~~w~You paid $%d in medical fees.~n~~n~~w~You can reduce this by buying insurance at the City Hall.",Rand);
        GameTextForPlayer(playerid,Insurance,5000,4);
        PlayerInfo[playerid][pDeaths] ++;
        PlayerInfo[killerid][pKills] ++;
        SendDeathMessage(killerid, playerid, reason);
        return 1;
    }
    if(gTeam[playerid] == Team_Civil && HasLifeInsurance[playerid] == true)
    {
        GameTextForPlayer(playerid,"~n~~w~Covered by life insurance.~n~~n~You are now ~r~not~w~ covered by life insurance.~n~~n~Visit the City Hall to buy more.",5000,4);
        HasLifeInsurance[playerid] = false;
        PlayerInfo[playerid][pDeaths] ++;
        PlayerInfo[killerid][pKills] ++;
        SendDeathMessage(killerid, playerid, reason);
        return 1;
    }
    if(AdminOnDuty[killerid] == true)
    {
        GameTextForPlayer(playerid,"~y~Unfair death.~n~~n~~w~Continuing current life.~n~~n~Your stats will stay the same.",5000,4);
        return 1;
    }
    if(DiedFromAdmin[playerid] == true)
    {
        SendDeathMessage(INVALID_PLAYER_ID,playerid, 40);
        return 1;
    }
    return 1;
}
Reply
#4

Just the usual /kill... Well in ZCMD.

pawn Код:
CMD:kill(playerid, params[])
{
    SetPlayerHealth(playerid, 0);
    return 1;
}
Reply
#5

Add on top:
pawn Код:
new UsedKillCmd[MAX_PLAYERS];
At command:
pawn Код:
CMD:kill(playerid, params[])
{
    UsedKillCmd[playerid] = 1;
    SetPlayerHealth(playerid, 0);
    return 1;
}
At OnPlayerDeath:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(UsedKillCmd[playerid] == 0)
    {
       SendClientMessage(killerid, COLOR_GREY, " You're now a murder! ");
       GivePlayerMoney(killerid, 500);
       SendClientMessage(playerid, COLOR_GREY, " You have been murdered! ");
       GivePlayerMoney(playerid, -500);
       return 1;
    }
    else
    {
       UsedKillCmd[playerid] = 0;
       return 0;
    }
    return 1;
}
Reply
#6

Why not?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendClientMessage(killerid, COLOR_GREY, " You're now a murder! ");
    GivePlayerMoney(killerid, 500);
    if(killerid != INVALID_PLAYER_ID) {
        SendClientMessage(playerid, COLOR_GREY, " You have been murdered! ");
        GivePlayerMoney(playerid, -500);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Mean
Посмотреть сообщение
Why not?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendClientMessage(killerid, COLOR_GREY, " You're now a murder! ");
    GivePlayerMoney(killerid, 500);
    if(killerid != INVALID_PLAYER_ID) {
        SendClientMessage(playerid, COLOR_GREY, " You have been murdered! ");
        GivePlayerMoney(playerid, -500);
    }
    return 1;
}
This worked. Thanks Mean!
Reply
#8

Quote:
Originally Posted by Mean
Посмотреть сообщение
Why not?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendClientMessage(killerid, COLOR_GREY, " You're now a murder! ");
    GivePlayerMoney(killerid, 500);
    if(killerid != INVALID_PLAYER_ID) {
        SendClientMessage(playerid, COLOR_GREY, " You have been murdered! ");
        GivePlayerMoney(playerid, -500);
    }
    return 1;
}
Completely forgot about that!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)