Showing team with most score? [helpme]
#1

Hello i use this code:
pawn Код:
#include <a_samp>

// you proberly already have somthing like this
#define TEAM_ENGLISH  0
#define TEAM_USA    1
#define TEAM_RUSSIA   2

// colour define for text draw colour
#define red     0xff0000ff

// textdraw vars
new Text:usaheader;
new Text:engheader;
new Text:rusheader;
new Text:usakills;
new Text:engkills;
new Text:ruskills;

// kill count (these go ++ onplayerdeath)
new usakillcount=0;
new engkillcount=0;
new ruskillcount=0;

// you proberly already have somthing like this
new gTeam[MAX_PLAYERS];

main()
{
    print("\n----------------------------------");
    print(" phil's textdraw for flake xD ");
    print("----------------------------------\n");
}


public OnGameModeInit()
{
    // create textdraws
  usaheader = TextDrawCreate(515,280,"U.S.A:");// change coords here to move the textdraws
    engheader = TextDrawCreate(515,320,"English:");// change coords here to move the textdraws
    rusheader = TextDrawCreate(515,320,"English:");// change coords here to move the textdraws
    usakills = TextDrawCreate(515,300," ");// change coords here to move the textdraws
    engkills = TextDrawCreate(515,340," ");// change coords here to move the textdraws
    ruskills = TextDrawCreate(515,380," ");// change coords here to move the textdraws
    // set their colours
    TextDrawColor(usaheader,red);
    TextDrawColor(engheader,red);
    TextDrawColor(rusheader,red);
    TextDrawColor(usakills,red);
  TextDrawColor(engkills,red);
  TextDrawColor(ruskills,red);
  // set outlines
    TextDrawSetOutline(usaheader,1);
    TextDrawSetOutline(engheader,1);
    TextDrawSetOutline(rusheader,1);
    TextDrawSetOutline(usakills,1);
    TextDrawSetOutline(engkills,1);
    TextDrawSetOutline(ruskills,1);
    // set shodow (i hate shadow always off xD)
    TextDrawSetShadow(usaheader,0);
    TextDrawSetShadow(engheader,0);
    TextDrawSetShadow(rusheader,0);
    TextDrawSetShadow(usakills,0);
    TextDrawSetShadow(engkills,0);
    TextDrawSetShadow(ruskills,0);
    // timer to update txtdraws once per second
    SetTimer("TextDrawUpdate",999,true);
    return 1;
}

forward TextDrawUpdate();
public TextDrawUpdate()
{
    new str1[50],str2[50],str3[50];
    // format killcounters
    format(str1,sizeof(str1),"%i",usakillcount);
    format(str2,sizeof(str2),"%i",engkillcount);
    format(str3,sizeof(str3),"%i",ruskillcount);
    // set the empty textdraw's
    TextDrawSetString(usakills,str1);
    TextDrawSetString(engkills,str2);
    TextDrawSetString(ruskills,str3);
    // show textdraw here so that it will update
    TextDrawShowForAll(usakills);
    TextDrawShowForAll(engkills);
    TextDrawShowForAll(ruskills);
    TextDrawShowForAll(usaheader);
    TextDrawShowForAll(engheader);
    TextDrawShowForAll(rusheader);
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

// here is where you add a kill for each kill a team does
public OnPlayerDeath(playerid, killerid, reason)
{
    if(gTeam[killerid] == TEAM_USA)
    {
      usakillcount++;
    }
    if(gTeam[killerid] == TEAM_ENGLISH)
    {
      engkillcount++;
    }
    if(gTeam[killerid] == TEAM_RUSSIA)
    {
      ruskillcount++;
    }
}
How do i only display the team with the most kills?

Please reply, thanks.
Reply
#2

pawn Код:
if(usakillcount > engkillcount)
    if(usakillcount > ruskillcount) SendClientMessage(playerid, "USA has the most kills");
    else SendClientMessage(playerid, "Russia has the most kills");
else if(engkillcount > ruskillcount) SendClientMessage(playerid, "England has the most kills");
else SendClientMessage(playerid, "Russia has the most kills");
Reply
#3

thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)