05.01.2013, 04:42
Try it:
I think you should add a Timer to update the textdraw:
I think you should add a Timer to update the textdraw:
PHP Code:
new Text:killstext;
public OnGameModeInit()
{
killstext = TextDrawCreate(1.0, 5.6, " ");
TextDrawAlignment(killstext, 2);
TextDrawBackgroundColor(killstext, 255);
TextDrawFont(killstext, 3);
TextDrawLetterSize(killstext, 0.709998, 2.100001);
TextDrawColor(killstext, -1);
TextDrawSetOutline(killstext, 1);
TextDrawSetProportional(killstext, 0);
return 1;
}
stock HandleKS(playerid, killerid) //put this function outside of any callbacks or functions
{
killstreak[playerid] = 0;
killstreak[killerid] ++;
new msg1[64], msg2[64], name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], textdraw[41];
GetPlayerName(playerid, name1, strlen(name1));
GetPlayerName(playerid, name2, strlen(name2));
format(msg1, strlen(msg1), "%s has ended %s's killstreak", name2, name1);
format(msg2, strlen(msg2), "%s is now on a killsreak of %i", name2, killstreak[killerid]);
format(textdraw, sizeof(textdraw), "%s: %i", name, killstreak[killerid]);
TextDrawSetString(killstext, newtext);
TextDrawShowForAll(killstext);
SendClientMessageToAll(COLOR_CYAN, msg1);
SendClientMessageToAll(COLOR_CYAN, msg2);
switch(killstreak[killerid])
{
case 3:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 3 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 4:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 4 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 5:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 5 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 6:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 6 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 7:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 7 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 8:
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 8 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
case 9: //change the numbers as desired and add/remove as many as you want
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s is now on a Killstreak of 9 Kills.",pName);
SendClientMessageToAll(COLOR_CYAN,string);
}
}
return 1;
}