Returning to where you died
#6

Alright this is my whole OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
    Died[playerid] = 1;
    if(PlayerInfo[killerid][jail] || PlayerInfo[playerid][jail]) return 1;
    if(gPlayerUsingLoopingAnim[playerid])
    {
        gPlayerUsingLoopingAnim[playerid] = 0;
        TextDrawHideForPlayer(playerid,txtAnimHelper);
    }
    File::SaveAccount(playerid);
    if(reason == 38 && GetAdminLevel(killerid) && !IsPlayerInAnyVehicle(killerid) && !PlayerTemp[killerid][isevent])
    {
        new Float:pP[4];
        GetPlayerPos(playerid,pP[0], pP[1], pP[2]);
        SetTimerEx("SetPlayerPosExEx", 2000, false, "dfffddd", playerid, pP[0], pP[1], pP[2], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), INVALID_VEHICLE_ID);
        return 1;
    }
    if(killerid != INVALID_PLAYER_ID && killerid != 54 && killerid != 255)
    {
        if(PlayerTemp[playerid][onpaint])
        {
            PlayerLoop(i)
            {
                if(!PlayerTemp[i][onpaint]) continue;
                SendClientMSG(i, COLOR_YELLOW, " [PB]: %s has killed %s with a %s (Distance: %dm)", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
                OnPlayerKillSpree(killerid);
            }
            return 1;
        }
        if(PlayerTemp[killerid][isevent])
        {
            PlayerLoop(i)
            {
                if(!PlayerTemp[i][isevent]) continue;
                SendClientMSG(i, COLOR_YELLOW, "..: [EVENT]: %s has killed %s with a %s (Distance: %dm):..", RPName(killerid), RPName(playerid), aWeaponNames[reason], GetDistanceBetweenPlayers(playerid, killerid));
                OnPlayerKillSpree(killerid);
            }
            PlayerTemp[playerid][isevent] = 0;
            return 1;
        }
        if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam] != HITMAN) SendDeathMessage(killerid,playerid,reason);
        {
            CheckWar();
            new winpoints;
            {
                switch(PlayerInfo[playerid][ranklvl])
                {
                    case 0: winpoints = 5;
                    case 1: winpoints = 2;
                    case 2: winpoints = 1;
                    default: winpoints = 1;
                }
            }
            if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction1") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction2"))
            {
                dini_IntSet(warfile, "faction1points", dini_Int(warfile,"faction1points") + winpoints);
            }
            else if(PlayerInfo[killerid][playerteam] == dini_Int(warfile,"faction2") && PlayerInfo[playerid][playerteam] == dini_Int(warfile,"faction1"))
            {
                dini_IntSet(warfile, "faction2points", dini_Int(warfile,"faction2points") + winpoints);
            }
        }
        //SetPlayerWantedLevel(playerid, 0);
        TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Status]);
        TextDrawHideForPlayer(playerid, TextDraw__News);
        TextDrawHideForPlayer(playerid, IMtxt);
        new
            string[ MAX_STRING ], wname[ 40 ], ragione[ 40 ];
        GetWeaponName(reason, wname, sizeof(wname));
        format( string, sizeof(string), "5..: [DEATH] %s[%d] has been killed by %s[%d] (%s) :..",PlayerName(playerid),playerid, PlayerName(killerid), killerid,wname);
        iEcho( string );
        format( string, sizeof(string), "[KILL] %s has killed %s with a %s", PlayerName(killerid), PlayerName(playerid), wname);
        AppendTo(deathlog, string);
        GetWeaponName(reason,ragione,40);

        if(IsPlayerDriver(killerid) && PlayerInfo[killerid][playerteam]!=EMS && PlayerInfo[killerid][playerteam]!=SASF && PlayerInfo[killerid][playerteam]!=FBI && PlayerInfo[killerid][playerteam]!=COPS && PlayerInfo[killerid][power]==0)
        {
            PlayerTemp[killerid][imprisoned] = 1;
            Jail(killerid,600,777,"Drive-by");
            format(iStr,sizeof(iStr),"{FFFFFF}[ {FF0000}ADMIN{FFFFFF} ] {FF6347}* SERVER has jailed %s for 10 minutes. Reason: Drive-by *",RPName(killerid));
            SendMessageToAll(COLOR_RED,iStr);
        }
        if(killerid != INVALID_PLAYER_ID && IsPlayerInPaintball(killerid))
        {
            if(PlayerTemp[playerid][pbteam] == 1) PBTeams[PlayerTemp[playerid][onpaint]][redscore]++;
            else PBTeams[PlayerTemp[playerid][onpaint]][bluescore]++;
            UpdatePBScore(PlayerTemp[playerid][onpaint], PBTeams[PlayerTemp[playerid][onpaint]][redscore], PBTeams[PlayerTemp[playerid][onpaint]][bluescore]);
            return 1;
        }
        if(killerid != INVALID_PLAYER_ID) PlayerInfo[killerid][kills]++;
        PlayerInfo[playerid][deaths]++;
        if(!strlen(ragione)) ragione="Fists";
        new deathmsg[MAX_STRING]; format(deathmsg,sizeof(deathmsg),"Info: You have paid $%d for the medical bills, have a nice day!",dini_Int(globalstats, "medicals"));
        SendClientMessage(playerid,COLOR_ORANGE,deathmsg);
        if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam]==HITMAN && PlayerInfo[playerid][head]>0)
        {
            if(strcmp(ragione,"Knife",true)==0)
            {
                new total;
                total=PlayerInfo[playerid][head]+((PlayerInfo[playerid][head]*15)/100);
                dini_IntSet(globalstats,"HitmanBank",dini_Int(globalstats,"HitmanBank")+total/2);
                GivePlayerMoneyEx(killerid, total/2);
                format(string,sizeof(string),"[HEAD] You earned $%d from %s head, plus 15-percent of his head because of knifekill.",PlayerInfo[playerid][head]/2,PlayerName(playerid));
                SendClientMessage(killerid,COLOR_YELLOW, string);
                PlayerInfo[playerid][head]=0;
            }
            else
            {
                GivePlayerMoneyEx(killerid, PlayerInfo[playerid][head]/2);
                dini_IntSet(globalstats,"HitmanBank",dini_Int(globalstats,"HitmanBank")+PlayerInfo[playerid][head]/2);
                format(string,sizeof(string),"[HEAD] You earned $%d from %s head.",PlayerInfo[playerid][head]/2,PlayerName(playerid));
                SendClientMessage(killerid,COLOR_YELLOW, string);
                PlayerInfo[playerid][head]=0;
            }
        }
        if(PlayerInfo[playerid][playerlvl] >= 3)
        {
            if(killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][playerteam]==COPS || PlayerInfo[killerid][playerteam]==FBI || PlayerInfo[killerid][playerteam]==SASF)
            { //cop contro ti
                GivePlayerMoneyEx(playerid,-10000);
                SendClientMessage(playerid, COLOR_HELPEROOC, "=======================================================================================");
                SendClientMessage(playerid, COLOR_HELPEROOC, " ");
                SendClientMessage(playerid,COLOR_WHITE,"EVADING: -10.000$ for resistance to the federal law.");
                SendClientMessage(playerid,COLOR_WHITE, "NOTE: If you think, that the law has abused their powers, take a screen shot and post it on the forums.");
                SendClientMessage(playerid, COLOR_HELPEROOC, " ");
                SendClientMessage(playerid, COLOR_HELPEROOC, "=======================================================================================");

                dini_IntSet(globalstats,"GovernmentBank",dini_Int(globalstats,"GovernmentBank")+5000);

                new stringa[ 128 ];
                format(stringa, sizeof(stringa), "Severely wounded by PD/SASF %s %s for resisting arrest", PlayerInfo[killerid][rankname], PlayerName(killerid));
//              PoliceDB(playerid, stringa);
            }
        }
    }
    else
    {
        if(PlayerInfo[playerid][power])
        {
            PlayerLoop(i)
            {
                SendDeathMessage(killerid, playerid, reason);
            }
            return 1;
        }
        new string[ 128 ];
        format(string,sizeof(string), ".:: Suicide: %s has suicided ::.", RPName(playerid));
        if(GetPVarInt(playerid, "SkinSelect") == 0) SendClientMessageToAll(COLOR_RED, string);
        format( string, sizeof(string), "5..: [DEATH] %s[%d] has suicided :..",PlayerName(playerid),playerid);
        iEcho( string );
        format( string, sizeof(string), "[KILL] %s has killed himself", PlayerName(playerid));
        AppendTo(deathlog, string);
    }
    return 1;
}
Not sure if this helps but im not getting it to work
But basiclly in my script if you die you spawn inside a HQ or a House. Not sure if thats conflicting anything
Reply


Messages In This Thread
Returning to where you died - by yoran765 - 23.06.2013, 19:27
Re: Returning to where you died - by Vlad64 - 23.06.2013, 19:35
Re: Returning to where you died - by yoran765 - 23.06.2013, 19:40
Re: Returning to where you died - by yoran765 - 23.06.2013, 19:44
Re: Returning to where you died - by Vlad64 - 23.06.2013, 20:04
Re: Returning to where you died - by yoran765 - 23.06.2013, 20:07
Re: Returning to where you died - by Vlad64 - 23.06.2013, 20:15

Forum Jump:


Users browsing this thread: 1 Guest(s)