SA-MP Forums Archive
problem with something - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with something (/showthread.php?tid=268212)



problem with something - Jay. - 11.07.2011

Hi,

I have made a killstreak system.

Heres only one example:
pawn Код:
if(Killspree[killerid] == 3)
    {
       GetPlayerName(killerid,playername,sizeof(playername));
       format(string,sizeof(string),"%s[%d] Is now on a killing spree of 3!", playername,playerid);
       SendClientMessageToAll(COLOR_GREEN,string);
       PlayerHasKillingSpree[killerid] = true;

    }
I also have made this:

pawn Код:
if(PlayerHasKillingSpree[playerid] == true)
    {
        SendClientMessage(playerid,COLOR_GREEN,"You died your killing spree ended.");
        GameTextForPlayer(playerid,"~W~You died~N~~R~Killing spree ended",3000,6);

    }
It checks if the player had a killing spree when he died and if so it will show that message but theres a problem. The message doesn't show to anyone , not even the dead player.

Any help is appreciated thanks.


Re: problem with something - Toreno - 11.07.2011

When player kills someone, does it add? I meant.
pawn Код:
VARIABLE[playerid]++;
Also, in which callbacks did you put these two codes? give me more effort to help you.


Re: problem with something - Jay. - 11.07.2011

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
When player kills someone, does it add? I meant.
pawn Код:
VARIABLE[playerid]++;
Also, in which callbacks did you put these two codes? give me more effort to help you.
Under OnPlayerdeath and yes it does count.

pawn Код:
Killspree[killerid]++;
    Killspree[playerid]=0;



Re: problem with something - Toreno - 11.07.2011

You put both of them under OnPlayerDeath? if so, that's dumb, because no matter what... the variable will return to 0. If not, then tell me where the Killspree[playerid] = 0; is standing.


Re: problem with something - Jay. - 11.07.2011

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
You put both of them under OnPlayerDeath? if so, that's dumb, because no matter what... the variable will return to 0. If not, then tell me where the Killspree[playerid] = 0; is standing.
It is under OnPlayerDeath.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new playerscore;
    new string[128];
    new playername[MAX_PLAYER_NAME];
    Killspree[killerid]++;
    Killspree[playerid]=0;
If that helps some more.
And yes, it may be dumb but I am dumb in this matter. so if you could help out it's all apreciated.
Thanks.


Re: problem with something - Toreno - 11.07.2011

Don't call yourself a dumb, programing isn't easy, if it was then everybody was smart and no plugins and filterscript or anything else would have released. I can help you but I ask last time, give me the full OnPlayerDeath and anything that (FULL) related to Killstreak then I'll help you, promising.


Re: problem with something - Jay. - 11.07.2011

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
Don't call yourself a dumb, programing isn't easy, if it was then everybody was smart and no plugins and filterscript or anything else would have released. I can help you but I ask last time, give me the full OnPlayerDeath and anything that (FULL) related to Killstreak then I'll help you, promising.
Yes, I am finding it very hard. But I would prefere if I didn't post this code to the public. Can I pm you ?


Re: problem with something - Wesley221 - 11.07.2011

pawn Код:
if(PlayerHasKillingSpree[playerid] >= 1)
{
    SendClientMessage(playerid,COLOR_GREEN,"You died your killing spree ended.");
    GameTextForPlayer(playerid,"~W~You died~N~~R~Killing spree ended",3000,6);
}
No need to show your whole codes, just the things which are needed.


Re: problem with something - Jay. - 11.07.2011

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
if(PlayerHasKillingSpree[playerid] >= 1)
{
    SendClientMessage(playerid,COLOR_GREEN,"You died your killing spree ended.");
    GameTextForPlayer(playerid,"~W~You died~N~~R~Killing spree ended",3000,6);
}
No need to show your whole codes, just the things which are needed.
I used a bool , so this wouldn't work. But thanks.
pawn Код:
new bool:PlayerHasKillingSpree[MAX_PLAYERS];



Re: problem with something - Toreno - 11.07.2011

Quote:
Originally Posted by Jay.
Посмотреть сообщение
Yes, I am finding it very hard. But I would prefere if I didn't post this code to the public. Can I pm you ?
Yes, of course you can.
Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
if(PlayerHasKillingSpree[playerid] >= 1)
{
    SendClientMessage(playerid,COLOR_GREEN,"You died your killing spree ended.");
    GameTextForPlayer(playerid,"~W~You died~N~~R~Killing spree ended",3000,6);
}
No need to show your whole codes, just the things which are needed.
It might be the solution, but he doesn't need to put >= on‌ly ==, I guess there isn't differences but it's better this way.