Players Loosing all money on death.
#1

Hey guys, I am using a heavily modified Godfather Script now the problem is whenever a player dies, regardless of how they die all their money will reset to $0.

From memory I can't remembering editing anything in the OnPlayerDeath that would effect this, I have coded a few different things attempting to save the money before the player dies but no luck.

Any assistance would be amazing, just ask if any code is nessacery.
Cheers.
Reply
#2

Yep, we will need you OnPlayerDeath callback, remember to put in in [pawn] [ /pawn] tags. (No spaces)
Reply
#3

Sorry was at work, Here it is..

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new name[MAX_PLAYER_NAME];
    new string[256];
    new victimteam;
    new Float:px,Float:py,Float:pz;
    new killerteam;
    PlayerBlindfolded[playerid] = 0;
//   TextDrawHideForPlayer(playerid, Textdraw0);
//   TextDrawHideForPlayer(playerid, Textdraw1);
    SetPlayerVirtualWorld(playerid, 0);
    victimteam = gTeam[playerid];
    killerteam = gTeam[killerid];
    gPlayerSpawned[playerid] = 0;
    GetPlayerName(playerid, name, sizeof(name));
    PlayerInfo[playerid][pLocal] = 255;
    GetPlayerPos(playerid, px, py, pz);
    if(killerid != 255)
    {
        if(GetPlayerState(killerid) == 2)
        {
            SendClientMessage(killerid, COLOR_YELLOW, "DriveBy Kill, dont abuse it, On foot gets you $$$!");
            return 1;
        }
    }
    if((reason == 8) || (reason == 9) || (reason == 16) || (reason == 26) || (reason == 28) || (reason == 32) || (reason == 35) || (reason == 36) || (reason == 38) || (reason == 39) || (reason == 40) || (reason == 42))
    {
        new kstring[128];
        new kickname[MAX_PLAYER_NAME];
        if(IsPlayerConnected(killerid))
        {
            GetPlayerName(killerid, kickname, sizeof(kickname));
            format(kstring, 128, "AdmWarning: [%d]%s just killed a player [id:%d] with an unscripted weapon. (%d)",killerid,kickname,playerid,reason);
            ABroadCast(COLOR_YELLOW,kstring,1);
            printf("%s", kstring);
            format(kstring, 128, "AdmWarning: [%d]%s is locked! Teleport to him",killerid,kickname);
            ABroadCast(COLOR_YELLOW,kstring,1);
            SendClientMessage(killerid, COLOR_RED, "Your account has been locked!");
            SendClientMessage(killerid, COLOR_YELLOW, " DO NOT MOVE, YOU WILL BE PERMANETLY BANNED! ");
            PlayerInfo[killerid][pLocked] = 1;
            TogglePlayerControllable(killerid, 0);
            ResetPlayerWeapons(killerid);
        }
    }
    if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
    {
        DisablePlayerCheckpoint(playerid);
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
    }
    new caller = Mobile[playerid];
    if(caller != 255)
    {
        if(caller < 255)
        {
            SendClientMessage(caller,  COLOR_GRAD2, "   The line just went dead....");
            CellTime[caller] = 0;
            CellTime[playerid] = 0;
            Mobile[caller] = 255;
        }
        Mobile[playerid] = 255;
        CellTime[playerid] = 0;
    }
    ClearCrime(playerid);
    if(GettingCK[playerid] < 999 || OnCK[playerid] < 999)
    {
        if(IsPlayerConnected(killerid))
        {
            if(GettingCK[killerid] < 999 || OnCK[playerid] < 999)
            {
                new killer[MAX_PLAYER_NAME];
                new dier[MAX_PLAYER_NAME];
                GetPlayerName(playerid, dier, sizeof(dier));
                GetPlayerName(killerid, killer, sizeof(killer));
                format(string, sizeof(string), "* %s has performed a Character Kill on you, you aren't able to play with this Character anymore.",killer);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                format(string, sizeof(string), "** %s has Character Killed %s **",killer,dier);
                CKLog(string);
                PlayerInfo[playerid][pCK] = 1;
                if(GettingCK[playerid] < 999) { GettingCK[playerid] = 999; }
                else if(OnCK[playerid] < 999) { OnCK[playerid] = 999; }
                if(GettingCK[killerid] < 999) { GettingCK[killerid] = 999; }
                else if(OnCK[killerid] < 999) { OnCK[killerid] = 999; }
                KickPlayer[playerid] = 1;
            }
        }
    }
    if(PlayerInfo[playerid][pHeadValue] > 0)
    {
        if(IsPlayerConnected(killerid))
        {
            if(gTeam[killerid] == 10 || PlayerInfo[killerid][pLeader] == 8)
            {
                if(GoChase[killerid] == playerid)
                {
                    ConsumingMoney[killerid] = 1;
                    new killer[MAX_PLAYER_NAME];
                    GetPlayerName(killerid, killer, sizeof(killer));
                    PlayerInfo[killerid][pCash] += 30 + PlayerInfo[playerid][pHeadValue];
                    format(string,128,"<< Hitman %s has fulfilled the contract on %s and collected $%d >>",killer,name,PlayerInfo[playerid][pHeadValue]);
                    SendFamilyMessage(8, COLOR_YELLOW, string);
                    PlayerInfo[playerid][pHeadValue] = 0;
                    GotHit[playerid] = 0;
                    GetChased[playerid] = 999;
                    GoChase[killerid] = 999;
                }
            }
        }
    }
    if(killerteam >=3) //civs and factions
    {
        if(IsPlayerConnected(killerid))
        {
            if(GetPlayerSkin(killerid) == 80 || GetPlayerSkin(killerid) == 81)
            {
                return 1;
            }
            if(reason != 49)
            {
                SetPlayerCriminal(killerid,255, "First Degree Murder");
            }
            else if (reason == 49)
            {
                SetPlayerCriminal(killerid,255, "Hit And Run");
            }
        }
    }
    if(GetPlayerState(killerid) == 1)
    {
        PlayerInfo[killerid][pKills]++;
    }
    if (victimteam >= 3 && PlayerInfo[playerid][pWantedLevel] > 0 && killerteam == 2)
    {
        PlayerInfo[playerid][pJailed] = 1;
        PlayerInfo[playerid][pArrested] += 1;
        PlayerInfo[playerid][pJailTime] = (((PlayerInfo[playerid][pWantedLevel])*(300))+300);
        JailPrice[playerid] = (((PlayerInfo[playerid][pWantedLevel])*(50))+150);
        PlayerInfo[playerid][pWantedLevel] = 0;
        BailTime[playerid] += 1;
        format(string, sizeof(string), "* You are in Jail for %d Seconds because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime]);
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
        format(string, sizeof(string), "* Your bail is set to $%d", JailPrice[playerid]);
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
        SendClientMessage(playerid, COLOR_LIGHTRED, "* Bail options will be available to you in 10 minutes.");
        SetPlayerFree(playerid,killerid, "Got Killed");
        WantLawyer[playerid] = 1;
    }
    if(PlayerInfo[playerid][pJailed] > 0)
    {
        if(PlayerInfo[killerid][pJailed] > 0)
        {
            if(GetPlayerSkin(killerid) == 80 || GetPlayerSkin(killerid) == 81)
            {
                return 1;
            }
            new jaildm = PlayerInfo[killerid][pJailTime];
            PlayerInfo[killerid][pJailTime] = (jaildm + 3600);
            WantLawyer[killerid] = 0;
            new sendername[MAX_PLAYER_NAME];
            GetPlayerName(killerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "AdmCmd: %s was Auto Kicked, reason: Jail Deathmatching", sendername);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            KickLog(string);
            Kick(killerid);
            return 1;
        }
    }
    killerid = INVALID_PLAYER_ID;
    SetPlayerColor(playerid,COLOR_GRAD2);
    //if(GetPlayerMoney(playerid)>100){GivePlayerMoney(playerid, 100);}
    //else{GivePlayerMoney(playerid, 50);}
    return 1;
}
cheers
Reply
#4

Anyone?
Sorry for the double-p.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)