SA-MP Forums Archive
Give score to all players in team? - 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)
+--- Thread: Give score to all players in team? (/showthread.php?tid=276086)



Give score to all players in team? - Admigo - 12.08.2011

Heey guys,
I made a zone capture with a timer and in the timer you get 5 score if you take the zone.
But how can i give 1 score to all players in a team.
I use gTeam[playerid].


Re: Give score to all players in team? - [HiC]TheKiller - 12.08.2011

pawn Код:
stock GiveTeamScore(gTeamVariable, scoreamount)
{
    for(new i; i < MAX_PLAYERS; i++) if(gTeam[i] == gTeamVariable) SetPlayerScore(i, GetPlayerScore(i) + scoreamount);
    return 1;
}
There ya go.


Re: Give score to all players in team? - Admigo - 12.08.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
stock GiveTeamScore(gTeamVariable, scoreamount)
{
    for(new x; x < MAX_PLAYERS; x++) if(gTeam[i] == gTeamVariable) SetPlayerScore(i, GetPlayerScore(i) + scoreamount);
    return 1;
}
There ya go.
Thanks dude but i get 2 errors:
Код:
C:\Users\Brandon\Desktop\GTA San Andreas\filterscripts\ladmin4v2.pwn(7029) : error 017: undefined symbol "i"
C:\Users\Brandon\Desktop\GTA San Andreas\filterscripts\ladmin4v2.pwn(7029) : error 017: undefined symbol "i"



Re: Give score to all players in team? - [HiC]TheKiller - 12.08.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
Thanks dude but i get 2 errors:
Код:
C:\Users\Brandon\Desktop\GTA San Andreas\filterscripts\ladmin4v2.pwn(7029) : error 017: undefined symbol "i"
C:\Users\Brandon\Desktop\GTA San Andreas\filterscripts\ladmin4v2.pwn(7029) : error 017: undefined symbol "i"
OOps, fixed, it's late here.


Re: Give score to all players in team? - Admigo - 12.08.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
OOps, fixed, it's late here.
How can i fix this then?


Re: Give score to all players in team? - emokidx - 12.08.2011

he edited his last post,,, read that..


Re: Give score to all players in team? - Admigo - 12.08.2011

Ooh lol didnt saw that. Thanks dude!
I want team chat to.
How can i do that?


Re: Give score to all players in team? - MadeMan - 12.08.2011

Quote:
Originally Posted by admigo
Посмотреть сообщение
Ooh lol didnt saw that. Thanks dude!
I want team chat to.
How can i do that?
pawn Код:
SendTeamMessage(teamid, color, const message[])
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && gTeam[i] == teamid)
        {
            SendClientMessage(i, color, message);
        }
    }
}



Re: Give score to all players in team? - [HiC]TheKiller - 12.08.2011

pawn Код:
public OnPlayerCommandText(playerid, text[])
{
    if(text[0] == '#') //Change # to another character if you want
    {
        new string[180], pname[24];
        GetPlayerName(playerid, pname, 24);
        format(string, sizeof(string), "%s: %s", pname, text[1]);
        for(new i; i < MAX_PLAYERS; i++) if(gTeam[playerid] == gTeam[i]) SendClientMessage(i, -1, string);
    }    
    return 1;
}
Give that a go.


Re: Give score to all players in team? - Admigo - 12.08.2011

Omg Thanks dude!