Little Problem
#1

Hello,

If i added the system when a Team win, it give Money & Score to them.
But one they respawn, Their scores also Get respawn.
Like if i did /setscore : 1 and i won 10 scores from Winning, when i join i just get 1 Score.
Same Happens with money.

Heres My Script:
pawn Код:
if(Team1Kills > Team2Kills)
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                if(gTeam[i] == TEAM1)
                {
                    GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
                    SetPlayerScore(i, GetPlayerScore(i) + 10);
                    GivePlayerMoney(i, GetPlayerMoney(i) + 10000);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
                else
                {
                    GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
            }
        }
        else if(Team2Kills > Team1Kills)
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                if(gTeam[i] == TEAM2)
                {
                    GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
                    SetPlayerScore(i, GetPlayerScore(i) + 10);
                    GivePlayerMoney(i, GetPlayerMoney(i) + 10000);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
                else
                {
                    GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
            }
        }
Please see to it.
The scores and Money never saves.
But when i give with /setscore or /setmoney, it saves.
Reply
#2

Show your /setscore and /setmoney commands. May be your using seperate variables for storing such data.
Reply
#3

LoadingandRound - this is respawn timer function?
Reply
#4

/setmoney
pawn Код:
CMD:setmoney(playerid, params[])
{
    new targetid, money, string[100];
    if(pInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
    if(sscanf(params, "ud", targetid, money)) return SCM(playerid, COLOR_RED, "[USAGE] /setmoney <playerid/part of name> <amount>");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
    ResetPlayerMoney(targetid);
    GivePlayerMoney(targetid, money);
    format(string, sizeof(string), "Admin %s has set your money to %d", GetName(playerid), money);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's money to %d", GetName(targetid), money);
    SCM(playerid, COLOR_GREEN, string);
    return 1;
}
/setscore
pawn Код:
CMD:setscore(playerid, params[])
{
    new targetid, score, string[100];
    if(pInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
    if(sscanf(params, "ud", targetid, score)) return SCM(playerid, COLOR_RED, "[USAGE] /setscore <playerid/part of name> <amount>");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
    SetPlayerScore(targetid, score);
    format(string, sizeof(string), "Admin %s has set your score to %d", GetName(playerid), score);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's score to %d", GetName(targetid), score);
    SCM(playerid, COLOR_GREEN, string);
    return 1;
}
Reply
#5

Do you use any kind of saving systems? Please show OnPlayerDisconnect too.
Reply
#6

My OnPlayerDisconect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsBeingSpeced[playerid] == 1)
    {
        for(new i=0;i<MAX_PLAYERS;++i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
    }
    if(INI_Exists(Path(playerid)))
    {
        new INI:file = INI_Open(Path(playerid));
        INI_WriteInt(file, "AdminLevel",pInfo[playerid][pAdmin]);
        INI_WriteInt(file, "VipLevel",pInfo[playerid][pVip]);
        INI_WriteInt(file, "Money",GetPlayerMoney(playerid));
        INI_WriteInt(file, "Score",GetPlayerScore(playerid));
        INI_WriteInt(file, "Muted", pInfo[playerid][pMute]);
        INI_WriteInt(file, "Frozen", pInfo[playerid][pFrozen]);
        INI_WriteInt(file, "Warnings", pInfo[playerid][pWarns]);
        INI_WriteInt(file, "Duty", pInfo[playerid][pDuty]);
        INI_WriteInt(file, "NoPM", pInfo[playerid][pNoPM]);
        INI_WriteInt(file, "Kills", pInfo[playerid][pKills]);
        INI_WriteInt(file, "Deaths", pInfo[playerid][pDeaths]);
        INI_Close(file);
        return 1;
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Do you use any kind of saving systems? Please show OnPlayerDisconnect too.
He is using my TDM gamemode :P
try to use this
pawn Код:
if(Team1Kills > Team2Kills)
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                if(gTeam[i] == TEAM1)
                {
                    GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
                    SetPlayerScore(i, GetPlayerScore(i) + 10);
                    GivePlayerMoney(i, 10000);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
                else
                {
                    GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
            }
        }
        else if(Team2Kills > Team1Kills)
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
                if(gTeam[i] == TEAM2)
                {
                    GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
                    SetPlayerScore(i, GetPlayerScore(i) + 10);
                    GivePlayerMoney(i, 10000);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
                else
                {
                    GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
                    SetTimer("LoadingandRound", 4000, false);
                    Team1Kills = 0;
                    Team2Kills = 0;
                }
            }
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)