Bugged Kill Streak, whats wrong with it?
#1

Ok so i made this so when a player is on a kill streak it does a GameTextForAll saying that " Bob is on a kill streak! "
but it is bugged in some way or another because it does this instead " ] is on a killstreak!" here is the code
this is under onplayerdeath
Код:
 	if(KillingSpree[killerid] == 3) // It finds if the player is on a Killing Spree of 3 kills , you may change
	{
		new killstringa[128];
		PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] + 2;
        SendClientMessage(killerid, 0xFF8400FF, " You are on a killing spree! This earned you 2 respect!");
        format(killstringa, sizeof(killstringa), " %s is on a killing spree with 3 kills!", killerid);
		GameTextForAll(killstringa, 3000, 1);
	}
	if(KillingSpree[killerid] ==5)
	{
		new killstringb[128];
	    PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] + 3;
	    SendClientMessage(killerid, 0xFF8400FF, " You are on a rampage! This earned you 3 repsect!");
	    format(killstringb, sizeof(killstringb), " %s is on a rampage with 5 kills! ", killerid);
		GameTextForAll(killstringb, 3000, 1);
	}
	if(KillingSpree[killerid] ==8)
	{
		new killstringc[128];
	    PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] + 4;
	    SendClientMessage(killerid, 0xFF8400FF, " You are on a masacre! This earned you 4 respect!");
		format(killstringc, sizeof(killstringc), " %s is on a masacre with 8 kills! ", killerid);
		GameTextForAll(killstringc, 3000, 1);
	}
	if(KillingSpree[killerid] ==10)
	{
		new killstringd[128];
		PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] +5;
	    SendClientMessage(killerid, 0xFF8400FF, " Ten kill streak! This earned you 5 respect!");
		format(killstringd, sizeof(killstringd), " %s has a streak of 10 kills!", killerid);
		GameTextForAll(killstringd, 3000, 1);
	}
	if(KillingSpree[killerid] ==11)
	{
		new killstringe[128];
	    PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] +6;
	    SendClientMessage(killerid, 0xFF8400FF, " You got 11 kills in a row! this earned you 6 respect!");
		format(killstringe, sizeof(killstringe), " %s has 11 kills in a row!", killerid);
		GameTextForAll(killstringe, 3000, 1);
		PlayerPlaySound(killerid, 2607, 0.0, 0.0, 0.0);
		PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash] +10000;
		GivePlayerMoney(killerid, 10000);
		SendClientMessage(killerid, 0xFF8400FF, " You just got a $10,000 dollar bonus! Keep up the good work. ");
	}
	if(KillingSpree[killerid] ==15)
	{
		new killstringf[128];
	    PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] +7;
	    SendClientMessage(killerid, 0xFF8400FF, " You got a 15 kill streak! This gave you 7 respect!");
	    format(killstringf, sizeof(killstringf), " %s is on a streak of 15 kills!", killerid);
	    GameTextForAll(killstringf, 3000, 1);
	    PlayerPlaySound(killerid, 1068, 0, 0, 0);
	    PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash] +15000;
	    GivePlayerMoney(killerid, 15000);
	    SendClientMessage(killerid, 0xFF8400FF, " You just got a $15,000 dollar bonus! Keep up the good work. ");
	}
	if(KillingSpree[killerid] ==20)
	{
		new killstringg[128];
		PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] +8;
	    SendClientMessage(killerid, 0xFF8400FF, " You have 20 kills! This gave you 8 respect!");
	    format(killstringg, sizeof(killstringg), " %s is on a 20 kill streak!", killerid);
	    GameTextForAll(killstringg, 3000, 1);
        PlayerPlaySound(killerid, 1183, 0, 0, 0);
        PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash] +20000;
        GivePlayerMoney(killerid, 20000);
        SendClientMessage(killerid, 0xFF8400FF, " You just got a $20,000 dollar bonus! Keep up the good work! ");
	}
	if(KillingSpree[killerid] ==25)
	{
		new killstringh[128];
	    PlayerInfo[killerid][pExp] = PlayerInfo[killerid][pExp] +10;
	    SendClientMessage(killerid, 0xFF8400FF, " You have 25 kills! this earned you 10 respect points!");
	    format(killstringh, sizeof(killstringh), " %s has reached a streak of 25 kills!", killerid);
		GameTextForAll(killstringh, 3000, 1);
		PlayerPlaySound(killerid, 1185, 0, 0, 0);
		PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash] +100000;
		GivePlayerMoney(killerid, 100000);
		SendClientMessage(killerid, 0xFF8400FF, " You have just recieved a $100,000 dollar bonus!");
		SendClientMessage(killerid, 0xFF8400FF, " Your killstreak count has been reset!");
		KillingSpree[killerid] = 0;
	}
Reply
#2

Thats because you didnt stored the 'killerid's name in a variable.
pawn Код:
format(killstringa, sizeof(killstringa), " /*this is for a string*/%s is on a killing spree with 3 kills!", /*this is an integer*/killerid);
So that will give random characters.
pawn Код:
stock GetName(playerid)
{
    new Name[24];
    GetPlayerName(playerid, Name, 24);
    return Name;
}
format(killstringa, sizeof(killstringa), " %s is on a killing spree with 3 kills!", GetName(killerid));
The 'GetName()' will return the 'playerid's name, this can be anyones name.
Reply
#3

Thank you for the help this fixed it and thank you for explaining why it fixed it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)