SA-MP Forums Archive
Spree not working.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spree not working.. (/showthread.php?tid=337644)



Spree not working.. - iOmar - 27.04.2012

Guys i add this but spree is not working.. Please help me

pawn Код:
if(GetPlayerScore(killerid) == 5)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+2);
        GivePlayerMoney(killerid, 1000);
       
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"Server News: %s is Now On Killing Spree Of 5 ",pName);
        SendClientMessageToAll(0xFF8000FF,string);
        SendClientMessage(killerid,COLOR_GREEN,"Congratulation! You Got +2 Scores and 1000$ Money For Killing 5 in Row!");
        return 1;
    }



Re: Spree not working.. - Twisted_Insane - 27.04.2012

You're doing something completely...irrelevant; if the player's score is '5', he's on a killing spree? So what if he relogs and his score will be 120 for example, will he have a spree of '121' on the next kill then? Better write a new one or check out my tutorial (in my signature)...


Re: Spree not working.. - iOmar - 27.04.2012

can u add this??. I want simple like mine. plz....


Re: Spree not working.. - milanosie - 27.04.2012

Put it on OnPlayerDeath and for KilledID instead of playerid


Re: Spree not working.. - Dan. - 27.04.2012

Try this.

pawn Код:
if(GetPlayerScore(killerid) == 5)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+2);
        GivePlayerMoney(killerid, 1000);
       
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid ,pName, sizeof(pName));
        format(string, sizeof(string),"Server News: %s is Now On Killing Spree Of 5 ",pName);
        SendClientMessageToAll(0xFF8000FF, string);
        SendClientMessage(killerid, COLOR_GREEN,"Congratulations! You got +2 score and 1000$ money for killing 5 in a row!");
        return 1;
    }



Re: Spree not working.. - Rudy_ - 27.04.2012

Lol this is a fail KillingSpree... Try under OnPlayerUpdate and check players score and then check if it's increased with 5 kills and he haven't died... << this is how you can do it try looking for a tutorial maybe.


Re: Spree not working.. - zbt - 27.04.2012

work with a variable

pawn Код:
new s[MAX_PLAYERS];
//
public OnPlayerDeath(playerid, killerid, reason) {
    s[playerid] = 0;
    s[killerid] ++;
    if(s[killerid] == 5) {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+2);
        GivePlayerMoney(killerid, 1000);
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"Server News: %s is Now On Killing Spree Of 5 ",pName);
        SendClientMessageToAll(0xFF8000FF,string);
        SendClientMessage(killerid,COLOR_GREEN,"Congratulation! You Got +2 Scores and 1000$ Money For Killing 5 in Row!");
        s[killerid] = 0;
    }
    return true;
}



Re: Spree not working.. - iOmar - 27.04.2012

@!zbt. it is giving these errors...

pawn Код:
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(716) : error 029: invalid expression, assumed zero
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(716) : error 001: expected token: ";", but found "{"
D:\Game\SA-MP Files\SF Wars\gamemodes\Wars.pwn(732) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.



Re: Spree not working.. - zbt - 27.04.2012

You are not adapting properly
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
    s[playerid] = 0;
    s[killerid] ++;
    if(s[killerid] == 5) {
        SetPlayerScore(killerid, GetPlayerScore(killerid)+2);
        GivePlayerMoney(killerid, 1000);
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(killerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"Server News: %s is Now On Killing Spree Of 5 ",pName);
        SendClientMessageToAll(0xFF8000FF,string);
        SendClientMessage(killerid,COLOR_GREEN,"Congratulation! You Got +2 Scores and 1000$ Money For Killing 5 in Row!");
        s[killerid] = 0;
    }
    //other functions



Re: Spree not working.. - iOmar - 27.04.2012

Thnx bro. thank you soo much. Its is working great........... (rep added all of u as gift )