payday help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: payday help (
/showthread.php?tid=326825)
payday help -
WardenCS - 18.03.2012
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;
}
Re: payday help -
Yvax - 18.03.2012
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;
}