About OnplayerDeath
#1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
    SendDeathMessage(killerid,playerid,reason);
    GameTextForPlayer(playerid,"~r~~b~haha",10000,1);
    GetPlayerName(playerid, pname, sizeof(pname));
    GetWeaponName(reason, deathreason, 20);
    new pstring[128]; //player message
    new killer[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killer, sizeof(killer));

    if(InDM[playerid]==1) InDM[playerid]=0;
    SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player
//--------------------------------Death Reasons---------------------------------
    if(killerid!=INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: { reasonMsg = "Unarmed"; }
            case 1: { reasonMsg = "Brass Knuckles"; }
            case 2: { reasonMsg = "Golf Club"; }
            case 3: { reasonMsg = "Night Stick"; }
            case 4: { reasonMsg = "Knife"; }
            case 5: { reasonMsg = "Baseball Bat"; }
            case 6: { reasonMsg = "Shovel"; }
            case 7: { reasonMsg = "Pool Cue"; }
            case 8: { reasonMsg = "Katana"; }
            case 9: { reasonMsg = "Chainsaw"; }
            case 10: { reasonMsg = "Dildo"; }
            case 11: { reasonMsg = "Dildo"; }
            case 12: { reasonMsg = "Vibrator"; }
            case 13: { reasonMsg = "Vibrator"; }
            case 14: { reasonMsg = "Flowers"; }
            case 15: { reasonMsg = "Cane"; }
            case 22: { reasonMsg = "Pistol"; }
            case 23: { reasonMsg = "Silenced Pistol"; }
            case 24: { reasonMsg = "Desert Eagle"; }
            case 25: { reasonMsg = "Shotgun"; }
            case 26: { reasonMsg = "Sawn-off Shotgun"; }
            case 27: { reasonMsg = "Combat Shotgun"; }
            case 28: { reasonMsg = "MAC-10"; }
            case 29: { reasonMsg = "MP5"; }
            case 30: { reasonMsg = "AK-47"; }
            case 31:
            {
                if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
                {
                    switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
                    {
                        case 447: { reasonMsg = "Sea Sparrow Machine Gun"; }
                        default: { reasonMsg = "M4"; }
                    }
                }
                else
                {
                    reasonMsg = "M4";
                }
            }
            case 32: { reasonMsg = "TEC-9"; }
            case 33: { reasonMsg = "Rifle"; }
            case 34: { reasonMsg = "Sniper Rifle"; }
            case 37: { reasonMsg = "Fire"; }
            case 38:
            {
                if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
                {
                    switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
                    {
                        case 425: { reasonMsg = "Hunter Machine Gun"; }
                        default: { reasonMsg = "Minigun"; }
                    }
                }
                else { reasonMsg = "Minigun"; }
            }
            case 41: { reasonMsg = "Spraycan"; }
            case 42: { reasonMsg = "Fire Extinguisher"; }
            case 49: { reasonMsg = "Vehicle Collision"; }
            case 50:
            {
                if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
                {
                    switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
                    {
                        case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563: { reasonMsg = "Helicopter Blades"; }
                        default: { reasonMsg = "Vehicle Collision"; }
                    }
                }
                else { reasonMsg = "Vehicle Collision"; }
            }
            case 51:
            {
                if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
                {
                    switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
                    {
                        case 425: { reasonMsg = "Hunter Rockets"; }
                        case 432: { reasonMsg = "Rhino Turret"; }
                        case 520: { reasonMsg = "Hydra Rockets"; }
                        default: { reasonMsg = "Explosion"; }
                    }
                }
                else { reasonMsg = "Explosion"; }
            }
            default: { reasonMsg = "Unknown"; }
        }
        format(string, sizeof(string), "*** %s killed %s. (%s)", killer, pname, reasonMsg);
        format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killer, pname, reasonMsg);
    }
    else
    {
        switch (reason)
        {
            case 53:
            {
                format(string, sizeof(string), "*** %s died. (Drowned)", pname);
                format(msg, sizeof(msg), "04*** %s died. (Drowned)", pname);
            }
            case 54:
            {
                format(string, sizeof(string), "*** %s died. (Collision)", pname);
                format(msg, sizeof(msg), "04*** %s died. (Collision)", pname);
            }
            default:
            {
                format(string, sizeof(string), "*** %s died.", pname);
                format(msg, sizeof(msg), "04*** %s died.", pname);
            }
        }
    }
//------------------------------------TeamKill----------------------------------
//--------------------------------Gang Zone-------------------------------------
    new Gang:killergang = Player_GetGang( killerid ),
    Gang:playergang = Player_GetGang( playerid ),
    Zone:killerzone = Player_GetZone( killerid ),
    Zone:playerzone = Player_GetZone( playerid );
    if( playergang != killergang ){
        if( killerzone == playerzone ){
            if( Zone_GetOwner( playerzone ) == playergang ){
                GangScores[ killergang ][ killerzone ]++;
                if( GangScores[ killergang ][ killerzone ] >= GANGWAR_WIN_SCORE ){
                    if( Zone_GetAttacker( killerzone ) == killergang )
                        CallLocalFunction( "OnGangCaptureZone", "iii", _:killergang, _:killerzone, _:playergang );
                    else
                        CallLocalFunction( "OnGangAttackZone", "iii", _:killergang, _:killerzone, _:playergang );
                }
            }
            else if( Zone_GetOwner( killerzone ) == killergang ){
                if( Zone_GetAttacker( playerzone ) == playergang && GangScores[ killergang ][ killerzone ]+1 >= GANGWAR_WIN_SCORE ){
                    GangScores[ killergang ][ killerzone ]++;
                    CallLocalFunction( "OnGangDefendZone", "iii", _:killergang, _:killerzone, _:playergang );
                }
                else if( Zone_GetAttacker( playerzone ) != playergang && GangScores[ killergang ][ killerzone ]-1 >= 0 )
                    GangScores[ playergang ][ killerzone ]--;
            }
        }
    }
//---------------------------------LAdmin---------------------------------------
    #if defined USE_STATS
    PlayerInfo[playerid][Deaths]++;
    #endif
    InDuel[playerid] = 0;

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        #if defined USE_STATS
        PlayerInfo[killerid][Kills]++;
        #endif

        if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
            GameTextForPlayer(killerid,"Winner !",3000,3);
            InDuel[killerid] = 0;
            SetPlayerPos(killerid, 0.0, 0.0, 0.0);
            SpawnPlayer(killerid);
        }
        else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
        }
    }
    #if defined ENABLE_SPEC
    for(new x=0; x<MAX_PLAYERS; x++)
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
           AdvanceSpectate(x);
    #endif
//-------------------------------------Normal-----------------------------------
    new kstring[128]; //killer message
    GetPlayerName(playerid, pname, sizeof(pname));
    format(kstring, sizeof(kstring), "~b~You Killed %s",pname);
    GameTextForPlayer(killerid, kstring, 4000, 3);
    new kname[MAX_PLAYER_NAME];   //killername
    GetPlayerName(killerid, kname, sizeof(kname));
    format(pstring, sizeof(pstring), "~r~You Got Owned By %s",kname);
    GameTextForPlayer(playerid, pstring, 4000, 3);
   
    new kscore=GetPlayerScore(killerid);
    SetPlayerScore(killerid,kscore++);
    PlayerInfo[playerid][Deaths]++;
    PlayerInfo[killerid][Kills]++;
    new moneytemp;
    moneytemp = GetPlayerMoney(playerid)/8;
    if(moneytemp<=5000) {
        GivePlayerMoney(killerid,moneytemp);
        GivePlayerMoney(playerid,-moneytemp);
    }
    else if(moneytemp>5000) {
        GivePlayerMoney(killerid,5000);
        GivePlayerMoney(playerid,-5000);
   
    }
    SendClientMessageToAll(COLOR_RED, string);
   
    DropWeapons(playerid);
    IsSpawned[playerid] = 0;
    cuffed[playerid] = 0;
    Tazed[playerid] = 0;
    hastazer[playerid] = 0;
    LawEnforcementRadio[playerid] = 0;
    HasLawEnforcementRadio[playerid] = 0;
    ReqBk[playerid] = 0;
    ReqBkRecent[playerid] = 0;
    ReportedRecent[playerid] = 0;
    VisitReq[playerid] = 0;
    EscapedConvict[playerid] = 0;
    VisitReqExpires[playerid] = 0;
    StoleCopCarRecent[playerid] = 0;
    triedtoescaperecent[playerid] = 0;
    JailTime[playerid] = 0;
    JailTimeServed[playerid] = 0;
    copshavevc[playerid] = 0;
    commitedcrimerecently[playerid] = 0;
    wantsheal[playerid] = 0;
    wantscure[playerid] = 0;
    InfectedPlyRecent[playerid] = 0;
    wantsweed[playerid] = 0;
    playeronweed[playerid] = 0;
    playertookweed[playerid] = 0;
    HasWeedBag[playerid] = 0;
    CuffedTime[playerid] = 0;
    cannotescapejail[playerid] = 0;
    RobbedPlyRecent[playerid] = 0;
    beenrobbedrecently[playerid] = 0;
    HasWallet[playerid] = 0;
    OldCash[playerid] = 0;
    Chlamydia[playerid] = 0;
    instunt[playerid] = 0;
    return 1;
}
I want to Make First Kill For 1 Score
And untill 60 kill For 60 score can Anyone Do IT ?
I realy needed help
Reply
#2

What did you mean by "And untill 60 kill For 60 score"?
Reply
#3

Can Anyone Help My This one ?
It Will MAke Killing spree
Reply
#4

pawn Код:
new
    Killing_Spree[ MAX_PLAYERS ]
;

// OnPlayerConnect:
Killing_Spree[ playerid ] = 0;

// OnPlayerDeath:
Killing_Spree[ playerid ] = 0;
if( killerid != INVALID_PLAYER_ID )
{
    Killing_Spree[ killerid ]++;
    switch( Killing_Spree[ killerid ] )
    {
        case 1: SetPlayerScore( killerid, GetPlayerScore( killerid ) + 1 );
        case 2 .. 60: SetPlayerScore( killerid, GetPlayerScore( killerid ) + 60 );
    }
}
Assuming you meant that on first killing spree, the player gets 1 score and from 2 to 60, the player gets 60 score.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
What did you mean by "And untill 60 kill For 60 score"?

It mean 1 kill 1 score

it mean 2 kill 2 score

like each kill is ranage up 1 score
Reply
#6

Oh. Then change in OnPlayerDeath to:
pawn Код:
// OnPlayerDeath:
Killing_Spree[ playerid ] = 0;
if( killerid != INVALID_PLAYER_ID )
{
    Killing_Spree[ killerid ]++;
    if( Killing_Spree[ killerid ] >= 1 && Killing_Spree[ killerid ] <= 60 )
    {
        SetPlayerScore( killerid, GetPlayerScore( killerid ) + Killing_Spree[ killerid ] );
    }
}
You said until 60.
Reply
#7

But wich part i replace in my Onplayer death ?
Reply
#8

In my opinion OnPlayeDeath() is the worst callback in SAMP
Reply
#9

Konstantinos
But wich part i replace in my Onplayer death ?
Can you tell
Reply
#10

Quote:
Originally Posted by donhu789
Посмотреть сообщение
But wich part i replace in my Onplayer death ?
None. You add that code.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
In my opinion OnPlayeDeath() is the worst callback in SAMP
It'd be great to get our own callbacks and have the control on them!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)