Problem with payday
#1

Hi,

I'm not posting this for myself but someone asked me to.

The problem is that only player ID 0 get the payday instead of all connected players.

Pastbin: http://pastebin.com/aN1ZnXmH


Thank you in advance.
Reply
#2

I'm not sure if work 100% but if there is any bugs u can solve easy
pawn Код:
forward PayDay(playerid);
forward GivePayDay(playerid);

public OnGameModeInit()
{
    SetTimer("GivePayDay",1000,true);//check every second for payday
    //...code
    return 1;
}
public GivePayDay(playerid)
{
    new h,m,s;gettime(h,m,s);
    if(m == 0 && s == 0)//minute 0 and second 0 mean fix hour :)
    {
        for(new i = 0; i<=MAX_PLAYERS;i++)
        {
            PayDay(i);
        }
    }
}
public PayDay(playerid)
{
    new string[128];
    new account,interest;
    new rent = 0;
    //if(afk[playerid] == 1){return 1;}
    if(PlayerInfo[playerid][pLevel] > 0)
    {
        if(MoneyMessage[playerid]==1)
        {
            SendClientMessage(i, COLOR_LIGHTRED, "Vous n'avez pas payй vos dettes, vous allez en prison.");
            SetPlayerInterior(i, 6);
            PlayerInfo[playerid][pInt] = 6;
            SetPlayerPos(i, 264.6288,77.5742,1001.0391);
            PlayerInfo[playerid][pJailed] = 1;
            ResetPlayerWeapons(i);
            WantedPoints[playerid] = 0;
            PlayerInfo[playerid][pJailTime] = 240;
            format(string, sizeof(string), "Vous кtes en prisons pour %d secondes.   Caution: Aucune", PlayerInfo[playerid][pJailTime]);
            SendClientMessage(i, COLOR_WHITE, string);
        }
        new infostring[128];
        new playername2[MAX_PLAYER_NAME];
        GetPlayerName(i, playername2, sizeof(playername2));
        account = PlayerInfo[playerid][pAccount];
        new assurance;
        if (PlayerInfo[playerid][pPcarkey] != -1)
        {
            assurance += 200;
        }
        if (PlayerInfo[playerid][pPcarkey2] != -1)
        {
            assurance += 200;
        }
        if (PlayerInfo[playerid][pPcarkey3] != -1)
        {
            assurance += 200;
        }
        if(PlayerInfo[playerid][pPcarkey4] != -1)
        {
            assurance += 200;
        }
        new key = PlayerInfo[playerid][pPhousekey];
        if(key != -1)
        {
            rent = HouseInfo[key][hRent];
            if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
            {
                rent = 0;
            }
            else if(rent > PlayerInfo[playerid][pAccount] && GetPlayerMoney(i))
            {
                PlayerInfo[playerid][pPhousekey] = -1;
                SendClientMessage(i, COLOR_WHITE, "Vous avez йtй йjectй car vous ne possйdiez pas assez d'argent pour payer votre loyer.");
                rent = 0;
            }
            HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
        }
        new housetaxe;
        if (key != -1 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
        {
            housetaxe = HouseInfo[key][hLevel] * 100;
        }
        else{housetaxe =0;}

        new tmpintrate;
        if(PlayerInfo[playerid][pDonateRank] > 0) { tmpintrate = 2; }
        else { tmpintrate = 1; }

        Tax += TaxValue;//Should work for every player online
        new checks = PlayerInfo[playerid][pPayCheck] + PlayerInfo[playerid][pJobExp];

        new ebill = (PlayerInfo[playerid][pAccount]/10000)*(PlayerInfo[playerid][pLevel]);
        //account += checks;
        if(PlayerInfo[playerid][pAccount] > 0)
        {
            PlayerInfo[playerid][pAccount] -= ebill;
            SBizzInfo[4][sbTill] += ebill;
        }
        else
        {
            ebill = 0;
        }

        new biztaxe;
        new keybiz = PlayerInfo[playerid][pPbiskey];
        if (keybiz != 255 && strcmp(playername2, HouseInfo[keybiz][hOwner], true) == 0)
        {
            BizzInfo[key][bDernierCompte] = BizzInfo[key][bTill];
            biztaxe = BizzInfo[key][bDernierCompte] - BizzInfo[key][bTill];
        }
        else{biztaxe =0;}

        interest = (PlayerInfo[playerid][pAccount]/100)*(tmpintrate); //multiplier j'ai mit un "+"

        if(PlayerInfo[playerid][pJob] == 0)
        {
            checks = 100;
            interest = 10;
            SendClientMessage(i, COLOR_WHITE, "Vous n'avez pas de travail. Vous touchez le RSA.");
        }
        PlayerInfo[playerid][pAccount] -= TaxValue - assurance - housetaxe;
        PlayerInfo[playerid][pExp]++;
        PlayerPlayMusic(i);
        PlayerInfo[playerid][pAccount] += checks+interest;
        PlayerPlaySound(i, 1097, 0.0, 0.0, 0.0);
        SendClientMessage(i, COLOR_YELLOW, "|________________ Extrait de Compte ________________|");
        format(string, sizeof(string), " Salaire Hors Taxe : $%d   Taxes : -$%d", checks, TaxValue);
        SendClientMessage(i, COLOR_WHITE, string);
        format(string, sizeof(string), " Assurance(s) Vehicule(s) : -$%d", assurance);
        SendClientMessage(i, COLOR_WHITE, string);
        format(string, sizeof(string), " Taxe(s) Habitation(s) : -$%d", housetaxe);
        SendClientMessage(i, COLOR_WHITE, string);

        if(PlayerInfo[playerid][pPhousekey] != -1 || PlayerInfo[playerid][pPbiskey] != 255)
        {
            format(string, sizeof(string), " Facture d'Electricitй : -$%d", ebill);
            SendClientMessage(i, COLOR_WHITE, string);
            format(string, sizeof(string), " Taxe Bizness : -$%d", biztaxe);
            SendClientMessage(i, COLOR_WHITE, string);
        }

        format(string, sizeof(string), " Argent sur le compte avant la Paye : $%d", account - checks);
        SendClientMessage(i, COLOR_WHITE, string);
        format(string, sizeof(string), " Taux d'оnterкt: 0.%d Pourcent => Interкt Gagnй : %d$",tmpintrate, interest);
        SendClientMessage(i, COLOR_WHITE, string);

        format(string, sizeof(string), " Location: -$%d", rent);
        SendClientMessage(i, COLOR_WHITE, string);
        SendClientMessage(i, COLOR_YELLOW, "|---------------------------------------------------------------------|");
        format(string, sizeof(string), " Argent sur le compte aprиs  la paye : $%d", PlayerInfo[playerid][pAccount]);
        SendClientMessage(i, COLOR_WHITE, string);

        format(string, sizeof(string), "~y~PayDay~n~~w~L'argent a ete depose sur votre compte bancaire");
        GameTextForPlayer(i, string, 5000, 1);
        rent = 0;
        PlayerInfo[playerid][pPayDay] = 0;
        PlayerInfo[playerid][pPayCheck] = 0;
        PlayerInfo[playerid][pWork] = 0;
        BizzInfo[key][bDernierCompte] = 0;
        SBizzInfo[2][sbTill] += ebill/2;
        ExtortionSBiz(2, ebill/2);
        new payoutas = 10
        SBizzInfo[13][sbTill] += payoutas;
        ExtortionSBiz(13, payoutas/2);
        ArgentGouv += TaxValue+housetaxe+biztaxe;
        if(IsACop(i) || PlayerInfo[playerid][pMember]== 7){ArgentGouv -= checks;}
        new nxtlevel = PlayerInfo[playerid][pLevel]+1;
        new expamount = nxtlevel*levelexp;
        if(PlayerInfo[playerid][pExp] >= expamount)
        {
            format(string, sizeof(string), "~g~Niveau Superieur Atteint~n~~w~Vous etes maintenant niveau %d", nxtlevel);
            PlayerPlaySound(i, 1052, 0.0, 0.0, 0.0);
            PlayerPlayMusic(i);
            PlayerInfo[playerid][pLevel]++;
            PlayerInfo[playerid][pExp] = 0;
            PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+2;
            GameTextForPlayer(i, string, 5000, 1);
            format(infostring, 256, " Niveau supйrieur atteint ! Tapez /ameliorer");
            SendClientMessage(i, COLOR_GRAD1, infostring);
            format(infostring, 256, "Vous avez %d points d'amйlioration non utilisйs.",PlayerInfo[playerid][gPupgrade]);
            SendClientMessage(i, COLOR_GRAD2, infostring);
        }
        if (PlayerInfo[playerid][pExp] < expamount)
        {
            format(infostring, 256, "Vous avez besoin de %d points de respect pour passer au niveau suivant, vous en avez %d.",expamount,PlayerInfo[playerid][pExp]);
            SendClientMessage(i, COLOR_GRAD1, infostring);
        }
        if(FarmerVar[playerid] == 0)
        {
            FarmerPickup[playerid][0] = 0;
        }
        if(SmugglerWork[playerid] == 0)
        {
            PayDaySecure[playerid] = 0;
        }
        if(PlayerInfo[playerid][pDonateRank] > 0)
        {
            PlayerInfo[playerid][pPayDayHad] += 1;
            if(PlayerInfo[playerid][pPayDayHad] >= 5)
            {
                PlayerInfo[playerid][pExp]++;
                PlayerInfo[playerid][pPayDayHad] = 0;
            }
        }
    }
    SaveStuff();
    SaveAccounts();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)