[HELP]Individual Deaths Screen Code Bug
#1

Ok i had a code working to show deaths and individual deaths(If u fall/Kill urself),Now i just added a killing spree code to OnPlayerDeath ,It worked fine b4 but now i cant see individual deaths,Killing spree works and normal kills show but individual ones dont :S

Can anyone help me,I think i may have layed it out wrong..

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 KillingSpree[killerid] ++;
 KillingSpree[playerid] = 0; 

 if(KillingSpree[killerid] == 3)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x3)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 4)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x4)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 5)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x5)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 6) 
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x6)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 7) 
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x7)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 8)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x8)",pname);
        SendClientMessageToAll(RED,string);
 }
 if(KillingSpree[killerid] == 9)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x9)",pname);
        SendClientMessageToAll(RED,string);
 }
  if(KillingSpree[killerid] == 10)
 {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Massive Killing Spree!(x10)!",pname);
        SendClientMessageToAll(RED,string);
        SendClientMessageToAll(RED, "%s Has Won $1 Million Dollars For A Massive x10 Killing Spree!");
        GivePlayerMoney(killerid, 1000000);//End killing spree code
 }
 else///Added this to see it it helps guide it through but does nothing

        if(killerid == INVALID_PLAYER_ID)///Should Be Working But Isnt
        {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
        }
        else
        {
        if(gTeam[killerid] != gTeam[playerid])//Works Fine
        {
                SendDeathMessage(killerid,playerid,reason);
                        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
                        GivePlayerMoney(killerid, 1000);
}
                else
                {
                new warning[256];
                format(warning, sizeof(warning), "Be Careful! Dont Kill Your Team Mates!");
                SendClientMessage(killerid, RED, warning);
                SendDeathMessage(killerid,playerid,reason);
                GivePlayerMoney(killerid, -5000);
                SetPlayerHealth(killerid, 0);
                SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
}

        }
        return 1;
}
Reply
#2

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 KillingSpree[killerid] ++;
 KillingSpree[playerid] = 0; 

 if(KillingSpree[killerid]>2)
 {
        if(KillingSpree[killerid]!=10)
        {
        new pname[24];
        new string[256];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Killing Spree!(x%i)",pname,KillingSpree[playerid]);
        SendClientMessageToAll(RED,string);
        }
        else
        {
        new pname[24];
        new string[128];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Massive Killing Spree!(x10)!",pname);
        SendClientMessageToAll(RED,string);
        SendClientMessageToAll(RED, "%s Has Won $1 Million Dollars For A Massive x10 Killing Spree!");
        GivePlayerMoney(killerid, 1000000);//End killing spree code
 }
 }
 {
        new pname[24];
        new string[128];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Massive Killing Spree!(x10)!",pname);
        SendClientMessageToAll(RED,string);
        SendClientMessageToAll(RED, "%s Has Won $1 Million Dollars For A Massive x10 Killing Spree!");
        GivePlayerMoney(killerid, 1000000);//End killing spree code
 }

        if(killerid == INVALID_PLAYER_ID)///Should Be Working But Isnt
        {
        SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
        }
        else
        {
        if(gTeam[killerid] != gTeam[playerid])//Works Fine
        {
                SendDeathMessage(killerid,playerid,reason);
                        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
                        GivePlayerMoney(killerid, 1000);
}
                else
                {
                new warning[128];
                format(warning, sizeof(warning), "Be Careful! Dont Kill Your Team Mates!");
                SendClientMessage(killerid, RED, warning);
                SendDeathMessage(killerid,playerid,reason);
                GivePlayerMoney(killerid, -5000);
                SetPlayerHealth(killerid, 0);
                SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
}

        }
        return 1;
}
if im right i optimised minimised and repairieized(lol) your code bbut im on myphoneso didnt test it

also check for loose bracckets bcuz when i counted it wasnt rite.
Reply
#3

WOW..Dude I Didnt Know You Could Do That :O,Im Amateur Scripter xD Dude Thanks Alot!

PS.Why is there 2 closing braces for the 1st x10 spree and under is another x10 spree?
Код:
}
}
{
        new pname[24];
        new string[128];
        GetPlayerName(killerid,pname,24);
        format(string,sizeof(string), "%s Is On A Massive Killing Spree!(x10)!",pname);
        SendClientMessageToAll(RED,string);
        SendClientMessageToAll(RED, "%s Has Won $1 Million Dollars For A Massive x10 Killing Spree!");
        GivePlayerMoney(killerid, 1000000);//End killing spree code
 }
Anyway i will just compile untill it works like i always do xD

And all the bug was is i didnt add closing brace xD

But thats how i learn

Dude,Thanks Again!@


EDIT: "Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase" 1st Go
Reply
#4

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
   
    if(killerid == INVALID_PLAYER_ID) {
        return SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    }
   
    if(gTeam[killerid] != gTeam[playerid]) { // The following code will only continue if the killerid and playerids teams do not match.
        switch(KillingSpree[killerid]) {
            case 3..9: {
                new
                    pName[MAX_PLAYER_NAME], string[64]; // You do NOT need 256 cells!

                GetPlayerName(killerid, pName, MAX_PLAYER_NAME);
                format(string, sizeof(string), "%s is on a killing spree (x%d)", pName, KillingSpree[killerid]);
                SendClientMessageToAll(RED, string);
            }
            case 10: {
                new
                    pName[MAX_PLAYER_NAME], string[100]; // You do NOT need 256 cells!

                GetPlayerName(killerid, pName, MAX_PLAYER_NAME);
                format(string, sizeof(string), "%s is on a massive killing spree (x10)", pName);
                SendClientMessageToAll(RED, string);
                format(string, sizeof(string), "%s has won $1 million dollars for fulfilling a massive x10 killing spree!", pName);
                SendClientMessageToAll(RED, string);
                SendDeathMessage(killerid, playerid, reason);
                SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
                GivePlayerMoney(killerid, 1000000);
            }
        }
    }
    else { // And if they do....
        SendClientMessage(killerid, RED, "Do NOT kill your team mates");
        GivePlayerMoney(killerid, -5000);
        SetPlayerHealth(killerid, 0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
    }

    return 1;
}
Reply
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
   
    if(killerid == INVALID_PLAYER_ID) {
        return SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    }
   
    if(gTeam[killerid] != gTeam[playerid]) { // The following code will only continue if the killerid and playerids teams do not match.
        switch(KillingSpree[killerid]) {
            case 3..9: {
                new
                    pName[MAX_PLAYER_NAME], string[64]; // You do NOT need 256 cells!

                GetPlayerName(killerid, pName, MAX_PLAYER_NAME);
                format(string, sizeof(string), "%s is on a killing spree (x%d)", pName, KillingSpree[killerid]);
                SendClientMessageToAll(RED, string);
            }
            case 10: {
                new
                    pName[MAX_PLAYER_NAME], string[100]; // You do NOT need 256 cells!

                GetPlayerName(killerid, pName, MAX_PLAYER_NAME);
                format(string, sizeof(string), "%s is on a massive killing spree (x10)", pName);
                SendClientMessageToAll(RED, string);
                format(string, sizeof(string), "%s has won $1 million dollars for fulfilling a massive x10 killing spree!", pName);
                SendClientMessageToAll(RED, string);
                SendDeathMessage(killerid, playerid, reason);
                SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
                GivePlayerMoney(killerid, 1000000);
            }
        }
    }
    else { // And if they do....
        SendClientMessage(killerid, RED, "Do NOT kill your team mates");
        GivePlayerMoney(killerid, -5000);
        SetPlayerHealth(killerid, 0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
    }

    return 1;
}
What are Cells?? I Just Thought 256 Was It xD

And WOW looks like u re-wrote the whole thing

Thanks Dude
Reply
#6

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
What are Cells?? I Just Thought 256 Was It xD

And WOW looks like u re-wrote the whole thing

Thanks Dude
You could read ******'s thread about 256 cells.
Reply
#7

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
You could read ******'s thread about 256 cells.
Link Plz IDK What Cells Are So Will Be HArd For Me To Search The Key Words xD

Thanks Dude
Reply
#8

new variable[20];
This is an array (Or string) with 20 cells.
The cells are identified as:
variable[0], variable[1], variable[2], etc up to variable[19].
There is no variable[20] since you start on 0.
Reply
#9

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
Link Plz IDK What Cells Are So Will Be HArd For Me To Search The Key Words xD

Thanks Dude
https://sampforum.blast.hk/showthread.php?tid=55261
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)