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


Messages In This Thread
Kill Streak Help. - by StormDust - 17.08.2013, 14:35
Re: Kill Streak Help. - by Cypress - 17.08.2013, 14:52
Re: Kill Streak Help. - by StormDust - 17.08.2013, 14:56
Re: Kill Streak Help. - by StormDust - 17.08.2013, 15:15

Forum Jump:


Users browsing this thread: 1 Guest(s)