SA-MP Forums Archive
Team Score Update Help - 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: Team Score Update Help (/showthread.php?tid=303990)



Team Score Update Help - §с†¶e®РµРe - 16.12.2011

I have got a server which has teams-
TEAM_I
TEAM_U
TEAM_P
TEAM_R
TEAM_U2
i want to make like for example if TEAM_I wins the people of TEAM_I will get 1 score each and that it is saved into a variable so that by typing a cmd people can see which country has how much score...


Re: Team Score Update Help - §с†¶e®РµРe - 16.12.2011

help


Re: Team Score Update Help - Tigerkiller - 16.12.2011

new TeamScoreRed;

if you want to intecrease it do:

TeamScoreRed += value;

for decrease

TeamScoreRed -= value;


Re: Team Score Update Help - [MG]Dimi - 16.12.2011

UNTESTED:
pawn Code:
#include <a_samp>

new TEAM_I_SCORE = 0, TEAM_U_SCORE = 0, TEAM_P_SCORE = 0, TEAM_R_SCORE = 0, TEAM_U2_SCORE = 0;
new gTeam[MAX_PLAYERS];
#define TEAM_I 0
#define TEAM_U 1
#define TEAM_U2 2
#define TEAM_P 3
#define TEAM_R 4

public OnPlayerDeath(playerid,killerid,reason)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
    switch(gTeam[playerid])/*I guess you used gTeam, if not just change it*/
    {
        case TEAM_I: TEAM_I_SCORE++;
        case TEAM_U: TEAM_U_SCORE++;
        case TEAM_P: TEAM_P_SCORE++;
        case TEAM_R: TEAM_R_SCORE++;
        case TEAM_U2: TEAM_U2_SCORE++;
        default: return 1;
    }
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/teamscore",true))
    {
        new msg[128];
        switch(gTeam[playerid])
        {
            case TEAM_U: format(msg,128,"Your Team Score: %i",TEAM_U_SCORE);
            case TEAM_I: format(msg,128,"Your Team Score: %i",TEAM_I_SCORE);
            case TEAM_P: format(msg,128,"Your Team Score: %i",TEAM_P_SCORE);
            case TEAM_R: format(msg,128,"Your Team Score: %i",TEAM_R_SCORE);
            case TEAM_U2: format(msg,128,"Your Team Score: %i",TEAM_U2_SCORE);
            default: return 1;
        }
        SendClientMessage(playerid,0xFF0000FF,msg);
        return 1;
    }
    return 0;
}



Re: Team Score Update Help - §с†¶e®РµРe - 17.12.2011

Quote:
Originally Posted by [MG]Dimi
View Post
UNTESTED:
pawn Code:
#include <a_samp>

new TEAM_I_SCORE = 0, TEAM_U_SCORE = 0, TEAM_P_SCORE = 0, TEAM_R_SCORE = 0, TEAM_U2_SCORE = 0;
new gTeam[MAX_PLAYERS];
#define TEAM_I 0
#define TEAM_U 1
#define TEAM_U2 2
#define TEAM_P 3
#define TEAM_R 4

public OnPlayerDeath(playerid,killerid,reason)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
    switch(gTeam[playerid])/*I guess you used gTeam, if not just change it*/
    {
        case TEAM_I: TEAM_I_SCORE++;
        case TEAM_U: TEAM_U_SCORE++;
        case TEAM_P: TEAM_P_SCORE++;
        case TEAM_R: TEAM_R_SCORE++;
        case TEAM_U2: TEAM_U2_SCORE++;
        default: return 1;
    }
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/teamscore",true))
    {
        new msg[128];
        switch(gTeam[playerid])
        {
            case TEAM_U: format(msg,128,"Your Team Score: %i",TEAM_U_SCORE);
            case TEAM_I: format(msg,128,"Your Team Score: %i",TEAM_I_SCORE);
            case TEAM_P: format(msg,128,"Your Team Score: %i",TEAM_P_SCORE);
            case TEAM_R: format(msg,128,"Your Team Score: %i",TEAM_R_SCORE);
            case TEAM_U2: format(msg,128,"Your Team Score: %i",TEAM_U2_SCORE);
            default: return 1;
        }
        SendClientMessage(playerid,0xFF0000FF,msg);
        return 1;
    }
    return 0;
}
Hey man its good but if the server restarts the score will become 0.Please tell hohw to save it and then load it when the server starts again.


Re: Team Score Update Help - Ballu Miaa - 17.12.2011

Quote:
Originally Posted by belhot1992
View Post
To do that you can do two things:
You can use an ini system which I don't recommend that much or you can save the information in a mysql database which is much better and would actually give you the possibility to display the information on a website later on.
Could you please tell us, How can we do it exactly.
We have hosted from volt-host , we got Free MySQL Database there. I've used dini to save it but am not it will save or not.

Can you make a variable of the score's which can be saved and loaded after the restart?


Re: Team Score Update Help - §с†¶e®РµРe - 17.12.2011

Hey man read my PM ^^^