Score system - HELP -
Saddin - 16.11.2012
Can you help me about making a score.
For example, when someone type /score, message comes:
TEAM1: (NumberOfKills) // TEAM2: (NumberOfKills)
Not. score on tab list - giving level, but comes one more number when someone kills other player.
AW: Score system - HELP -
Skimmer - 16.11.2012
Hmm, do you have a variable on your script for saving team kills?
Re: Score system - HELP -
Sam5513 - 16.11.2012
Код:
new team1score=0; // declaring team 1 score
new team2score=0; //declaring team 2 score
new team[MAX_PLAYERS]; //will use to find out team of player
Код:
public OnPlayerRequestClass(playerid,classid)
{
if(classid(playerid)==0)
{
team[playerid]=0; //setting team of player
}
if(classid(playerid)==1)
{
team[playerid]=1; //setting team of player
}
}
Код:
OnPlayerDeath(playerid,killerid,reason)
{
if(team[killerid]==0)
{
team1score++; //adding kill to team which killed player
}
if(team[playerid]==1)
{
team2score++; //adding kill to team which killed player
}
if(team[playerid]==0)
{
team1score++;
}
}
Код:
CMD:score(playerid,params[]) //displaying kills
{
new string[100];
format(string,sizeof(string),"Team1:%i,Team2:%i",team1score,team2score);
SendClientMessage(playerid,COLOR_BLUE,string);
}
Untested. Hope it works
Re: Score system - HELP -
Saddin - 16.11.2012
I have
pScore
So: OnPlayerDeath: when someone from TEAM1 kill someone from TEAM2, to pScoreTEAM1 +1, or when someone from TEAM2 kill someone from TEAM1, to pScoreTEAM2 +1.
Re: Score system - HELP -
Sam5513 - 16.11.2012
Just to let you know
means that the value will be added by one.
Re: Score system - HELP -
Saddin - 16.11.2012
Can you explain me what : if(
classid(playerid)==0) is here for.
Re: Score system - HELP -
Sam5513 - 16.11.2012
remember on top of your script you do
to create teams? So [cpde]onplayerrequestclass[/code] it checks what PlayerClass have you select (on the initial menu of skin select) and sets the team of player that we declared on top of the script to the team he chose. Get it?
Re: Score system - HELP -
Saddin - 16.11.2012
Is this right?
Код:
OnPlayerDeath(playerid,killerid,reason)
{
if(team[killerid]==0)
{
team1score++; //adding kill to team which killed player
}
if(team[playerid]==1)
{
team2score++; //adding kill to team which killed player
}
if(team[playerid]==0)
{
team1score++;
}
}
InGame when I killed someone i get 2points for team1, when someone kill me, I again get points.
Re: Score system - HELP -
Sam5513 - 17.11.2012
oh sorry. its my bad.. I was sleepy. It should be just
Код:
OnPlayerDeath(playerid,killerid,reason)
{
if(team[killerid]==0)
{
team1score++; //adding kill to team which killed player
}
if(team[playerid]==1)
{
team2score++; //adding kill to team which killed player
}
}
The previous code added score to team one twice.
Re: Score system - HELP -
Saddin - 17.11.2012
I dont think this is right. Correct me if I'm wrong.
if(team[
killerid]==0)
{
team1score++; //adding kill to team which killed player
}
For Team1 one more score.
if(team[
playerid]==1)
{
team2score++; //adding kill to team which killed player
}
For team 2 one more score.
Why is for team1score++ killerid
And why is for team2score++ playerid
Re: Score system - HELP -
Konstantinos - 17.11.2012
pawn Код:
// Correct
if(team[killerid]==0)
{
team1score++; //adding kill to team which killed player
}
pawn Код:
// Wrong
if(team[playerid]==1)
{
team2score++; //adding kill to team which killed player
}
If someone dies from the team 2, you add score. It should be minus 1!
Re: Score system - HELP -
Sam5513 - 17.11.2012
Yes, my bad again. sorry. Its supposed to be [killerid] for the second case too.