05.04.2011, 06:45
Hello people,I use a default GF script and now I've created a system of payday that occurs when a player is expensive payday 30 points, but payday is coming to me every 5 minutes, a player has accumulated those 30 points payday, if someone knows we will issue a quick help
Codes:
i evo payday pulic
Codes:
Код:
forward paydaymin(playerid); //TIMER
Код:
pPaydaymin, //ENUM PINFO
Код:
SetTimer("paydaymin",60000,1); //TIMER za DODAVANJE PAYDAY BODOVA
Код:
public paydaycheck(playerid) { if (PlayerInfo[playerid][pPaydaymin] >= 30) { PayDay(playerid); } } public paydaymin(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { PlayerInfo[i][pPaydaymin] = PlayerInfo[i][pPaydaymin]+1; } }
Код:
public PayDay(playerid) { new string[256]; new account,interest; new rent = 0; if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pPaydaymin] >= 30) { new playername2[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername2, sizeof(playername2)); account = PlayerInfo[playerid][pAccount]; new key = PlayerInfo[playerid][pPhousekey]; if(key != 255) { rent = HouseInfo[key][hRent]; if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { rent = 0; } else if(rent > GetPlayerMoney(playerid)) { PlayerInfo[playerid][pPhousekey] = 255; SendClientMessage(playerid, COLOR_WHITE, "You have been evicted."); rent = 0; } HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent; } new tmpintrate; if (key != 255 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { if(PlayerInfo[playerid][pDonator] > 0) { tmpintrate = intrate+4; } else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel] } else { if(PlayerInfo[playerid][pDonator] > 0) { tmpintrate = 3; } else { tmpintrate = 1; } } Tax += TaxValue;//Should work for every player online PlayerInfo[playerid][pAccount] -= TaxValue; if(PlayerInfo[playerid][pDonator] > 0) { new bonus = PlayerInfo[playerid][pPayCheck] / 2; PlayerInfo[playerid][pPayCheck] += bonus; } new checks = PlayerInfo[playerid][pPayCheck]; new ebill = (PlayerInfo[playerid][pAccount]/10000)*(PlayerInfo[playerid][pLevel]); ConsumingMoney[playerid] = 1; GivePlayerMoney(playerid, checks); if(PlayerInfo[playerid][pAccount] > 0) { PlayerInfo[playerid][pAccount] -= ebill; SBizzInfo[4][sbTill] += ebill; } else { ebill = 0; } interest = (PlayerInfo[playerid][pAccount]/1000)*(tmpintrate); PlayerInfo[playerid][pExp]++; PlayerPlayMusic(playerid); PlayerInfo[playerid][pAccount] = account+interest; SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|"); format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue); SendClientMessage(playerid, COLOR_GRAD1, string); if(PlayerInfo[playerid][pPhousekey] != 255 || PlayerInfo[playerid][pPbiskey] != 255) { format(string, sizeof(string), " Electricity Bill: -$%d", ebill); SendClientMessage(playerid, COLOR_GRAD1, string); } format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate); SendClientMessage(playerid, COLOR_GRAD2, string); format(string, sizeof(string), " Interest Gained $%d", interest); SendClientMessage(playerid, COLOR_GRAD3, string); SendClientMessage(playerid, COLOR_GRAD4, "|--------------------------------------|"); format(string, sizeof(string), " New Balance~n~: $%d", PlayerInfo[playerid][pAccount]); SendClientMessage(playerid, COLOR_GRAD5, string); format(string, sizeof(string), " Rent: -$%d", rent); SendClientMessage(playerid, COLOR_GRAD5, string); format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck"); GameTextForPlayer(playerid, string, 5000, 1); rent = 0; PlayerInfo[playerid][pPayDay] = 0; PlayerInfo[playerid][pPaydaymin] = 0; PlayerInfo[playerid][pPayCheck] = 0; PlayerInfo[playerid][pConnectTime] += 1; if(PlayerInfo[playerid][pDonator] > 0) { PlayerInfo[playerid][pPayDayHad] += 1; if(PlayerInfo[playerid][pPayDayHad] >= 5) { PlayerInfo[playerid][pExp]++; PlayerInfo[playerid][pPayDayHad] = 0; } } } if(MoneyMessage[playerid]==1) { SendClientMessage(playerid, COLOR_LIGHTRED, "Zatvoreni ste zbog dugova!."); GameTextForPlayer(playerid, "~r~Uhicen!", 2000, 1); SetPlayerInterior(playerid, 6); SetPlayerPos(playerid, 264.6288,77.5742,1001.0391); PlayerInfo[playerid][pJailed] = 1; ResetPlayerWeapons(playerid); WantedPoints[playerid] = 0; PlayerInfo[playerid][pJailTime] = 300; format(string, sizeof(string), "Zatvoreni ste na 5 minuta"); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); } if(PlayerInfo[playerid][pLevel] > 0) { if(PlayerInfo[playerid][pLevel] > 0) { new nxtlevel = PlayerInfo[playerid][pLevel]+1; new expamount = nxtlevel*levelexp; if (PlayerInfo[playerid][pExp] >= expamount) { format(string, sizeof(string), ""GMBOJA"Level++ || Cestitamo upravo ste postali %d Level!",nxtlevel); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlayMusic(playerid); PlayerInfo[playerid][pLevel]++; if(PlayerInfo[playerid][pDonator] > 0) { PlayerInfo[playerid][pExp] -= expamount; new total = PlayerInfo[playerid][pExp]; if(total > 0) { PlayerInfo[playerid][pExp] = total; } else { PlayerInfo[playerid][pExp] = 0; } } else { PlayerInfo[playerid][pExp] = 0; } GameTextForPlayer(playerid, string, 5000, 1); } } else { SendClientMessage(playerid, -1, ""CRVENA"Obavijest | "BJELA"Nisi dovoljno igrao da dobijes placu."); } } } Checkprop(); return 1; }