SA-MP Forums Archive
team score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: team score (/showthread.php?tid=55329)



team score - FUNExtreme - 14.11.2008

hello,
I got a question.
how do you script a teams score and when a team has like 50 kills (1 kill, 1 score) that team wins
diddent find anything in the wiki. If you got a wiki page for me plz post. I wanted to make it myself but i cant cuz i dont have any info.
thanks in advantage


Re: team score - Rks25 - 14.11.2008

new scoreteam;

scoreteam++;


Re: team score - FUNExtreme - 14.11.2008

Quote:
Originally Posted by Rks_
new scoreteam;

scoreteam++;
and work with a counter then??


Re: team score - FUNExtreme - 15.11.2008

can you guys plz give some more info
Thanks in advantage


Re: team score - kymsar - 15.11.2008

new killlerteam[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
killlerteam[killerid]+=1;
}

SetTimer("checkscore", 1000, 1);

public checkscore()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(killlerteam [ i ]>=50)
{
winthendosomething();
return 1;
}
}
}

public winthendosomething()
{
dosomething;
}


Re: team score - LarzI - 15.11.2008

I believe that won't work...

Try making an enum, then create a variable with the enum, and use that to set the score..
Ex:
http://pastebin.ca/1256992


Re: team score - FUNExtreme - 15.11.2008

Код:
F:\San andreas server stuff\Mini Missions\MBDM.pwn(34) : error 009: invalid array size (negative, zero or out of bounds)
F:\San andreas server stuff\Mini Missions\MBDM.pwn(224) : warning 213: tag mismatch
F:\San andreas server stuff\Mini Missions\MBDM.pwn(225) : warning 213: tag mismatch
F:\San andreas server stuff\Mini Missions\MBDM.pwn(233) : warning 213: tag mismatch
F:\San andreas server stuff\Mini Missions\MBDM.pwn(234) : warning 213: tag mismatch
F:\San andreas server stuff\Mini Missions\MBDM.pwn(242) : warning 213: tag mismatch
F:\San andreas server stuff\Mini Missions\MBDM.pwn(243) : warning 213: tag mismatch
The first error comes from this line
pawn Код:
new teamScore[pTeams];
I get tag mismatch for the variable
pawn Код:
teamScore



Re: team score - LarzI - 15.11.2008

Show me how you put it in your script...


Re: team score - FUNExtreme - 15.11.2008

Heres the onplayerdeath where the mismatches come from
pawn Код:
//OnPlayerDeath
if(gTeam[playerid] == TEAM_COR)
    {
    teamScore[TEAM_COR]++;
    if(teamScore[TEAM_COR] >= 50)
    {
        GameTextForAll("~w~Corleones Won",5000,3);
        SetTimer("EndGM", 10000,0);
    }
    }
else if(gTeam[playerid] == TEAM_TAT)
    {
    teamScore[TEAM_TAT]++;
    if(teamScore[TEAM_TAT] >= 50)
    {
        GameTextForAll("~y~Tattaglias Won",5000,3);
        SetTimer("EndGM", 10000,0);
    }
    }
else if(gTeam[playerid] == TEAM_CUN)
    {
    teamScore[TEAM_CUN]++;
    if(teamScore[TEAM_CUN] >= 50)
    {
        GameTextForAll("~b~Cuneos Won",5000,3);
        SetTimer("EndGM", 10000,0);
    }
    }
}
And this at my other defines and new's and stuff
pawn Код:
new teamScore[pTeams];
Did I do something wrong?


Re: team score - LarzI - 15.11.2008

I hope you put the enum with TEAM_COR, TEAM_TAT and TEAM_CUN over main()
pawn Код:
enum pTeams
{
    TEAM_COR,
    TEAM_TAT,
    TEAM_CUN
};