Kill Streak Help.
#1

Made a Command to go on a Kill streak. Made two variables. 1 for the info for the server that he's on the Kill streak mission. And the 2nd to count the Kills. The first one works. See what I've done:
//on Top//

new KillStreakCount[MAX_PLAYERS];
new IsOnKillStreak[MAX_PLAYERS];

// on player death//

public OnPlayerDeath(playerid,killerid,reason)
{
SendDeathMessage(killerid,playerid,reason);
GameTextForPlayer(playerid,"~r~Died!", 3000, 3);
if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GivePlayerMoney(killerid, 500);
GameTextForPlayer(killerid,"~y~Normal Kill~n~Earned ~r~1 Score ~g~500$", 3000, 3);
PlayerPlaySound(killerid,5461,0,0,0);
PlayerPlaySound(playerid,3201,0,0,0);
}
if(IsOnKillStreak[playerid] == 0)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 2);
SendClientMessage(killerid,COLOR_LIGHTRED,"2 Score Bonus.");
KillStreakCount[killerid] +1;
return 1;
}
return 1;
}

//the cmd//
CMDtreak(playerid,params[])
#pragma unused params
{
if(GetPlayerMoney(playerid) > 19999)
{
IsOnKillStreak[playerid] = 1;
GivePlayerMoney(playerid,-20000);
SetTimerEx("KillStreakEnd",300000,false,"d",player id);
SendClientMessage(playerid,COLOR_YELLOW,"5 Kills in 5 Minutes. Can you do it");
return 1;
}
if(GetPlayerMoney(playerid) < 19999)
{
SendClientMessage(playerid,COLOR_RED,"You need 20000$ to go on Kill Streak Mission.");
return 1;
}
return 1;
}

// the timer//

forward KillStreakEnd(playerid);
public KillStreakEnd(playerid)
{
if(KillStreakCount[playerid] > 4)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) +10);
SendClientMessage(playerid,COLOR_GREEN,"You done great. You've earned 10 Scores.");
IsOnKillStreak[playerid] = 0;
return 1;
}
if(KillStreakCount[playerid] < 5)
{
SendClientMessage(playerid,COLOR_RED,"You Failed and lost 20000$");
GivePlayerMoney(playerid,-20000);
IsOnKillStreak[playerid] = 0;
return 1;
}
return 1;
}

//-----------//

it gives you 2 bonus scores but after 5 minutes when you've done 5 or more kills. it says mission failed. I also get a warning for the KillStreakCount[killerid] +1; which i guess is the problem. So any solution or another way to do it?
Thanks for reading
Reply
#2

Assuming your script the the kill streak is counted only once because you check if it's on 0, and when it is, you set it to 1 and if you have a next kill, it won't work because your kill streak is 1 and not 0 anymore.

pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
SendDeathMessage(killerid,playerid,reason);
GameTextForPlayer(playerid,"~r~Died!", 3000, 3);
if(killerid != INVALID_PLAYER_ID)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GivePlayerMoney(killerid, 500);
GameTextForPlayer(killerid,"~y~Normal Kill~n~Earned ~r~1 Score ~g~500$", 3000, 3);
PlayerPlaySound(killerid,5461,0,0,0);
PlayerPlaySound(playerid,3201,0,0,0);
}

SetPlayerScore(killerid, GetPlayerScore(killerid) + 2);
SendClientMessage(killerid,COLOR_LIGHTRED,"2 Score Bonus.");
KillStreakCount[killerid]++;
KillStreakCount[playerid] = 0;

return 1;
}
return 1;
}
I'm not really sure what you are trying to do, your script is pretty much mixed up.
Reply
#3

The variable i set to 1 is only for the server to know the player is on the Kill Streak mission. The problem is more about the counting variable. The player needs atleast 5 kills to win otherwise he looses. Anyway the line with ++ instead of +1 cleared the warning going to test now maybe it works thanks so far
Reply
#4

Cool it works now, just would like to add one feature. That it shows a message with all kills and deaths he had while he was on the 5 minute kill streak mission. How to do it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)