payday help
#1

Hello,i tried to create a payday system,if the racket is owned by faction then the rCash will be added to fCash,but i dont understand,if it will be added,it will add every racket cash,heres the payday

Код:
forward PayDay();
public PayDay()
{
for(new r = 0; r <= MAX_RACKETS; r++)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
new string[128];
new OwnerID = RacketInfo[r][rOwner];
OrgInfo[OwnerID][fCash] += RacketInfo[r][rCash];
if(PlayerInfo[i][Member] == OwnerID)
{
SendClientMessage(i, COLOR_GRAD1, "Faction earnings");
format(string, sizeof(string), "[INFO]: Old Balance: $%d | New Balance: $%d", OrgInfo[OwnerID][fCash] - RacketInfo[r][rCash], OrgInfo[OwnerID][fCash]);
SendClientMessage(i, COLOR_GRAD1, string);
}
}
}
return 1;
}
Reply
#2

I didn't exactly get what you ment but...
pawn Код:
forward PayDay();
public PayDay()
{
    new OwnerID;
    for(new r = 0; r <= MAX_RACKETS; r++)
    {
        if(RacketInfo[r][rOwner] != 0)//check if it's owned
        {
            OwnerID = RacketInfo[r][rOwner];
            OrgInfo[OwnerID][fCash] += RacketInfo[r][rCash];
            RacketInfo[r][rCash] = 0;//You might also want to reset the cash...
        }
    }
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][Member] == OwnerID && PlayerInfo[i][Member] != 0)
        {
            SendClientMessage(i, COLOR_GRAD1, "Faction earnings");
            format(string, sizeof(string), "[INFO]: Old Balance: $%d | New Balance: $%d", OrgInfo[OwnerID][fCash] - RacketInfo[r][rCash], OrgInfo[OwnerID][fCash]);
            SendClientMessage(i, COLOR_GRAD1, string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)