Team Score Update Help
#1

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...
Reply
#2

help
Reply
#3

new TeamScoreRed;

if you want to intecrease it do:

TeamScoreRed += value;

for decrease

TeamScoreRed -= value;
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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?
Reply
#7

Hey man read my PM ^^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)