OnPlayerDeath
#1

Hey, i want to make that when you die you will drop all the weapons you have, but this code does only drop the weapon you are holding. can you help me with that?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SecurityCam[playerid] = 0;
    PissCounter[playerid] = 0;

    if(gettime() - CarJackKilledAt[playerid] <= 10 || (PlayerInfo[playerid][pAdmin] & ADMIN_ACCESS && SpawnChange[playerid] == 4))
    {
        if(gettime() - CarJackKilledAt[playerid] > 10)
        {
            SaveHealth[playerid] = 100;
        } else {
            GetPlayerHealth(playerid,SaveHealth[playerid]);
        }

        GetPlayerArmour(playerid,SaveArmor[playerid]);
       
        CarJackKilledAt[playerid] = 1;
        GetPlayerPos(playerid,
            adminResurrect[playerid][adX],
            adminResurrect[playerid][adY],
            adminResurrect[playerid][adZ]
        );
        GetPlayerFacingAngle(playerid,adminResurrect[playerid][adF]);
        adminResurrect[playerid][adI] = GetPlayerInterior(playerid);
        adminResurrect[playerid][adW] = GetPlayerVirtualWorld(playerid);

        return 1;
    }

    new string[256];

    if(PlayerPaintballing[playerid] != 0)
    {
        if(killerid != 65535)
        {
            PlayerPaintballKills[killerid] ++;
            if(PlayerPaintballKills[killerid] > PaintballWinnerKills)
            {
                PaintballWinner = killerid;
                PaintballWinnerKills = PlayerPaintballKills[killerid];
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(PlayerPaintballing[i] != 0)
                        {
                            format(string, sizeof(string), "* %s is in the lead with %d kills.",Name(killerid),PaintballWinnerKills);
                            SendClientMessage(i, COLOR_WHITE, string);
                        }
                    }
                }
            }
        }
        return 1;
    }

    PlayerInfo[playerid][pIntoxication] = 0;
    SetPlayerDrunkLevel(playerid,0);

    //new dmessage[128];
    //new deathreason[20];
    new playercash;
    new victimteam;
    new killerteam;
   
    if(PlayerInfo[playerid][pBanished]){
        PlayerInfo[playerid][pArmor] = 0.0;
        SetPlayerArmour(playerid,0.0);
        RemoveWeapons(playerid);
        return 1;
    }

    MedicBill[playerid] = 1;

    new pdeathcash = GetMoney(playerid);
    if(pdeathcash > 15000)
    {
        GiveMoney(playerid,-(pdeathcash - 15000));
    }
    if(PlayerInfo[playerid][pPot] > 10)
    {
        PlayerInfo[playerid][pPot] = 10;
    }
    if(PlayerInfo[playerid][pCrack] > 10)
    {
        PlayerInfo[playerid][pCrack] = 10;
    }

    new totalmats = PlayerInfo[playerid][pMats] + PlayerInfo[playerid][pMatsb] + PlayerInfo[playerid][pMatsc];
    if(totalmats > 5000)
    {
        new Float:divisor = floatdiv(totalmats,5000);
        PlayerInfo[playerid][pMats] = floatround(floatdiv(PlayerInfo[playerid][pMats],divisor),floatround_floor);
        PlayerInfo[playerid][pMatsb] = floatround(floatdiv(PlayerInfo[playerid][pMatsb],divisor),floatround_floor);
        PlayerInfo[playerid][pMatsc] = floatround(floatdiv(PlayerInfo[playerid][pMatsc],divisor),floatround_floor);
    }
    PlayerInfo[playerid][pArmor] = 0.0;
    SetPlayerArmour(playerid,0.0);
    RemoveWeapons(playerid);
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    DropWeapons(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid),playerid);
    SetPlayerWeapons(playerid);
Reply


Messages In This Thread
OnPlayerDeath - by Mikkel_RE - 27.11.2012, 19:53
AW: OnPlayerDeath - by Skimmer - 27.11.2012, 20:06
Re: OnPlayerDeath - by Mikkel_RE - 27.11.2012, 20:11
Re: OnPlayerDeath - by [KHK]Khalid - 27.11.2012, 20:14
Re: OnPlayerDeath - by Mikkel_RE - 27.11.2012, 20:23
AW: OnPlayerDeath - by Skimmer - 27.11.2012, 20:32
Re: OnPlayerDeath - by Mikkel_RE - 27.11.2012, 20:39
Re: OnPlayerDeath - by [KHK]Khalid - 27.11.2012, 21:02

Forum Jump:


Users browsing this thread: 2 Guest(s)