PDA

View Full Version : /scorelist? rep +


oscar7610
26/04/2012, 08:02 PM
I want to make a score list /scorelist for teams (currently have 6)

Like

/scorelist
===================
Russians 6 kills.
Italians 8 kills.
===================

MP2
26/04/2012, 08:41 PM
You're not giving enough details, elaborate.

How do you store the data?
Do you already store it? If so, we need to know what variables you use etc.

How do you want it displayed?
Chat? Dialog? Textdraw? Cheese?

What team variables etc. are you using?
How can someone write code for something they know nothing about?

oscar7610
26/04/2012, 08:56 PM
I only have.
#include <a_samp>
#include <sscanf2>
#include <SII>
#include <dini>
#include <streamer>
#include <func>

I want a cmd /scorelist.

Teams/
#define ITALIAN_MAFIA 0
#define RUSSIAN_MAFIA 1
#define HITMANS 2
#define BIKER 3
#define ELITEG 4
#define GANGZ 5

When for example a russian kills an italian it show.

/scorelist
==========
Russian 1 kills.
Italian 0 kills.
Bikers 0 kills. etc etc ....
========== Like that


understood? im a newb here.

MP2
26/04/2012, 09:06 PM
You still haven't answered my questions:
How do you store the data?
Do you already store it? If so, we need to know what variables you use etc.

How do you want it displayed?
Chat? Dialog? Textdraw? Cheese?

oscar7610
26/04/2012, 09:09 PM
You still haven't answered my questions:

Displayed chat.

And the store thing I dont have I think yeah. can we use Dini? I have Luxadmin too.

oscar7610
26/04/2012, 09:34 PM
anyone?

ViniBorn
26/04/2012, 09:46 PM
Each team kill, store the number in a variable.

Example for 1 team :

new Kills;

//OnPlayerDeath
if(team[killerid] == ITALIAN_MAFIA)
Kill++;


Now it's your turn ...

[MG]Dimi
26/04/2012, 09:48 PM
//top of script
new TeamScore[6] = 0;

//callback
public OnPlayerDeath(playerid,killerid,reason)
{
if(killerid != INVALID_PLAYER_ID)
{
TeamScore[GetPlayerTeam(killerid)]++;
}
return 1;
}

//command

public OnPlayerCommandText(playerid,cmdtext[]) // I guess you are using strcmp
{
if(!strcmp("/scorelist",cmdtext,true))
{
new string[128];
SendClientMessage(playerid,0xFFFF00FF,"Team Scores:");
format(string,128,"1) Italian Mafia: %d",TeamScore[0]);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,128,"2) Russian Mafia: %d",TeamScore[1]);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,128,"3) Hitmans: %d",TeamScore[2]);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,128,"4) Bikers: %d",TeamScore[3]);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,128,"5) EliteG: %d",TeamScore[4]);
SendClientMessage(playerid,0xFFFF00FF,string);
format(string,128,"6) Gangz: %d",TeamScore[5]);
SendClientMessage(playerid,0xFFFF00FF,string);
return 1;
}
return 0;
}

oscar7610
26/04/2012, 09:54 PM
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup .pwn(1022) : error 017: undefined symbol "TeamScore"
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup .pwn(1022) : error 001: expected token: ";", but found "]"
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup .pwn(1022) : error 029: invalid expression, assumed zero
C:\Users\Oscar\Desktop\*\Gangwarz\gamemodes\backup .pwn(1022) : fatal error 107: too many error messages on one line

ViniBorn
26/04/2012, 09:58 PM
It is easier to use a function that gets the team's name.
Avoid the use of many SendClientMessage / format

oscar7610
26/04/2012, 09:59 PM
It is easier to use a function that gets the team's name.
Avoid the use of many SendClientMessage / format

I can try yours but I want /scorelist ]

ViniBorn
26/04/2012, 10:01 PM
What are the variables that define the player's team?

oscar7610
26/04/2012, 10:04 PM
What are the variables that define the player's team?


Im a noob here I dont know man I just have 5 teams And.

#define ITALIAN_MAFIA 0
#define RUSSIAN_MAFIA 1
#define HITMANS 2
#define BIKER 3
#define ELITEG 4
#define MARASALVA 5
/////////////////////////////////////////////
#define ITALIAN_MAFIA_COLOR 0xFA0505FF //Red//
#define RUSSIAN_MAFIA_COLOR 0x33AA33FF //green//
#define HITMANS_COLOR 0xFFFF00AA //yellow//
#define BIKER_COLOR 0x0000BBAA //blue
#define ELITEG_COLOR 0x8A4ED4FF // purple
#define MARASALVA_COLOR 0xFFFFFFAA // White
/////////////////////////////////////////////

ViniBorn
26/04/2012, 10:06 PM
Isn't this. Defines only facilitate the identification ID of each.

It is something like:
new Team [MAX_PLAYERS];

oscar7610
26/04/2012, 10:07 PM
new gTeam[MAX_PLAYERS];

ViniBorn
26/04/2012, 10:17 PM
//Top
new TeamKills[6]; // Number of teams

//OnPlayerDeath
TeamKills[gTeam[killerid]]++;

//OnPlayerCommandText
if(!strcmp(cmdtext,"/scorelist"))
{
new VBString[30];
SendClientMessage(playerid,-1,"----- Team Kills -----");
for(new i; i != 6; i++)
{
format(VBString,sizeof VBString,"[%d] %s: %d kills",i,GetTeamName(i),TeamKills[i]);
SendClientMessage(playerid,-1,VBString);
}
return true;
}

//Anywhere
GetTeamName(TeamID)
{
new TeamName[14];
switch(TeamID)
{
case 0: format(TeamName, 14, "ITALIAN_MAFIA");
case 1: format(TeamName, 14, "RUSSIAN_MAFIA");
case 2: format(TeamName, 8, "HITMANS");
case 3: format(TeamName, 6, "BIKER");
case 4: format(TeamName, 7, "ELITEG");
case 5: format(TeamName, 6, "GANGZ");
}
return TeamName;
}

oscar7610
26/04/2012, 10:28 PM
il try it thanks rep + thanks.

oscar7610
26/04/2012, 10:47 PM
So when a team kills someone from another team it will show 1 kills right?

ViniBorn
26/04/2012, 10:54 PM
//OnPlayerDeath
TeamKills[gTeam[killerid]]++; // Every kill, TeamKills of player's team +1