Killstreak TextDraw
#1

Hello Guys,

i need a Textdraw in which it should show :
Player Name : Their Kill streak.

It should be Like this :


My Kill streak System:
Code:
new killstreak[MAX_PLAYERS];
//OnplayerConnect: 
killstreak[playerid] = 0;

//OnPlayerDisconnect:
killstreak[playerid] = 0;

//OnPlayerDeath:
HandleKS(playerid, killerid);

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];

     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]);

     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;
}
Hope you will Help me!
Reply
#2

Try it:

I think you should add a Timer to update the textdraw:

PHP Code:
new Text:killstext;
public 
OnGameModeInit()
{
    
killstext TextDrawCreate(1.05.6" ");
    
TextDrawAlignment(killstext2);
    
TextDrawBackgroundColor(killstext255);
    
TextDrawFont(killstext3);
    
TextDrawLetterSize(killstext0.7099982.100001);
    
TextDrawColor(killstext, -1);
    
TextDrawSetOutline(killstext1);
    
TextDrawSetProportional(killstext0);
    return 
1;
}
stock HandleKS(playeridkillerid//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(playeridname1strlen(name1));
     
GetPlayerName(playeridname2strlen(name2));
     
format(msg1strlen(msg1), "%s has ended %s's killstreak"name2name1);
     
format(msg2strlen(msg2), "%s is now on a killsreak of %i"name2killstreak[killerid]);
     
format(textdrawsizeof(textdraw), "%s: %i"namekillstreak[killerid]);
    
TextDrawSetString(killstextnewtext);
    
TextDrawShowForAll(killstext);
     
SendClientMessageToAll(COLOR_CYANmsg1);
     
SendClientMessageToAll(COLOR_CYANmsg2);
     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;

Reply
#3

Error on this Line :
TextDrawSetString(killstext, newtext);

Error:
Code:
C:\DOCUME~1\User\Desktop\Server\GAMEMO~1\rvsy.pwn(469) : error 017: undefined symbol "newtext"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

TextDrawSetString(killstext, textdraw);
Reply
#5

No Textdraw appear in-game?
HelP!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)