Jump to content
  • 0

Bonus la un numar de jucatori conectati


Question

Posted

salutare,

Am facut comanda /setbonus (sa ofere un nr de bani, puncte RP, puncte PP) la un numar de jucatori conectati, dar bonusul il ofera doar jucatorului care foloseste comanda.

 

Quote

CMD:setbonus(playerid, params[]) {
    new money, rp, pp, players, string[128];
    if(sscanf(params, "iiii", money, rp, pp, players)) return SCM(playerid, COLOR_SERVER, "Syntax: {FFFFFF}/setbonus [money] [respect points] [premium points] [players online]");
    if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, -1, AdminOnly);
    
    SetBonusActiv = 1;
    MoneyAll = money;
    PremiumPointsForAll = pp;
    RespectPointsForAll = rp;
    PlayersOnlineForBonus = players;

    format(string, sizeof(string), "La %d jucatori conectati toti jucatorii vor primi $%s, %d respect points si %d premium points.", players, FormatNumber(money), rp, pp);
    SendClientMessageToAll(COLOR_GOLD, string);
    //SendStaffMessage(COLOR_GOLD, string);
    return 1;
}

 

Functia BonusForAll e apelata la OnGameModeInit odata la 1 secunda.

Quote

function BonusForAll() {
    new string[129];
    foreach(Player, i) {
        if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) {
            if(GetPlayersOnline() == PlayersOnlineForBonus) {
                if(SetBonusActiv == 1) {

                    format(string, sizeof(string), "The server has reached %d players online and you have received: $%s, %d respect points, %d premium points.", PlayersOnlineForBonus, FormatNumber(MoneyAll), RespectPointsForAll, PremiumPointsForAll);
                    SCM(i, COLOR_YELLOW, string);

                    PlayerInfo[i][pCashMoney] += MoneyAll;
                    UpdateVar(i, "CashMoney", PlayerInfo[i][pCashMoney]);
                    ResetPlayerMoney(i);
                    GivePlayerMoney(i, PlayerInfo[i][pCashMoney]);

                    PlayerInfo[i][pRespectPoints] += RespectPointsForAll;
                    UpdateVar(i, "RespectPoints", PlayerInfo[i][pRespectPoints]);

                    PlayerInfo[i][pPremiumPoints] += PremiumPointsForAll;
                    UpdateVar(i, "PremiumPoints", PlayerInfo[i][pPremiumPoints]);

                    SetBonusActiv = 0;
                    MoneyAll = 0;
                    PremiumPointsForAll = 0;
                    RespectPointsForAll = 0;
                    PlayersOnlineForBonus = 0;
                }
            }
        }
    }
    return 1;
}

 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.