Payday trouble
#1

I want to make a constant payday. Everyhour 100k. How do I make this ? I am awarding with reps.

Код:
public PayDay()
{
	PlayerLoop(i)
	{
		File::SaveAccount(i);
	}
	new ore,minuti,secondi;
	gettime(ore,minuti,secondi);
	new fambank[ 40 ], fbank = 0;
	if((minuti==0 || minuti==1) && paycheck==0)
	{
	    paycheck=1;
		new bcash, brob;
		new bname[ 128 ];
		for(new q; q < sizeof(teams); q++)
		{
			format(fambank, sizeof(fambank), "%sBank", teams[q][teamname]);
			new ftmp = dini_Int(globalstats,fambank);
			if(ftmp != 0 && ftmp < 1000000) dini_IntSet(globalstats, fambank, ftmp + ftmp/1000);
		}
		for(new i=0;i<=MAX_PLAYERS;i++)
		{
			if(IsPlayerConnected(i))
			{
				if(PLAYERLIST_authed[i])
				{
					if(PlayerInfo[i][playertime] >= 6000)
					{
					    if(PlayerInfo[i][playerteam] != CIV && PlayerInfo[i][playerteam] != 0)
						{
							format(fambank,sizeof(fambank),"%sBank",PlayerInfo[i][PTeamName]);
							fbank = dini_Int(globalstats,fambank);
							if(fbank > PlayerInfo[i][fpay])
							{
								PlayerTemp[i][givefpay] = PlayerInfo[i][fpay];
								dini_IntSet(globalstats, fambank, fbank - PlayerInfo[i][fpay]);
							}
						}
						PlayerInfo[i][rpoints]++;
						if(PlayerTemp[i][fightstyleleft] > 0) PlayerTemp[i][fightstyleleft]--;
						new filename2[30];
						if((PlayerInfo[i][rpoints]/2)>=PlayerInfo[i][playerlvl] && PlayerInfo[i][playerlvl]>8)
						{
						  	PlayerInfo[i][playerlvl]++;
						  	PlayerInfo[i][rpoints]=0;
					  	  	dUserSetINT(PlayerName(i)).("rpoints",PlayerInfo[i][rpoints]);
						  	dUserSetINT(PlayerName(i)).("level",PlayerInfo[i][playerlvl]);
						  	SetPlayerScore(i,PlayerInfo[i][playerlvl]);
						  	MessagePayDay(i,PlayerInfo[i][rpoints],PlayerInfo[i][playerlvl],PlayerInfo[i][rentprice],PlayerInfo[i][playertime], PlayerTemp[i][givefpay]);
				          	SendClientMessage(i,COLOR_GREEN,"[PayTime] You have levelled up!");
				          	if(PlayerTemp[i][fightstyleleft] < 2) SendClientMessage(i,COLOR_WHITE,"[Gym] You need some training, you are losing fighting skills.");
			          	}
						if(PlayerInfo[i][rpoints] >= 9 && PlayerInfo[i][playerlvl] <= 8)
						{
					  		PlayerInfo[i][playerlvl]++;
					  		PlayerInfo[i][rpoints]=0;
				  	  		dUserSetINT(PlayerName(i)).("rpoints",PlayerInfo[i][rpoints]);
					  		dUserSetINT(PlayerName(i)).("level",PlayerInfo[i][playerlvl]);
					  		SetPlayerScore(i,PlayerInfo[i][playerlvl]);
					  		MessagePayDay(i,PlayerInfo[i][rpoints],PlayerInfo[i][playerlvl],PlayerInfo[i][rentprice],PlayerInfo[i][playertime], PlayerTemp[i][givefpay]);
			          		SendClientMessage(i,COLOR_GREEN,"[PayTime] You have levelled up!");
				          	if(PlayerTemp[i][fightstyleleft] < 2) SendClientMessage(i,COLOR_WHITE,"[Gym] You need some training, you are losing fighting skills.");
			          	}
					  	else
				  		{
					    	dUserSetINT(PlayerName(i)).("rpoints",PlayerInfo[i][rpoints]);
					    	if(PlayerInfo[i][bank] < 750000000) PlayerInfo[i][bank]=PlayerInfo[i][bank]+(PlayerInfo[i][bank]/500);
							else PlayerInfo[i][bank] = PlayerInfo[i][bank]+(750000000/500);
					    	MessagePayDay(i,PlayerInfo[i][rpoints],PlayerInfo[i][playerlvl],PlayerInfo[i][rentprice],PlayerInfo[i][playertime], PlayerTemp[i][givefpay]);
				          	if(PlayerTemp[i][fightstyleleft] < 2) SendClientMessage(i,COLOR_WHITE,"[Gym] You need some training, you are losing fighting skills.");
					    }
					    new tax = dini_Int(globalstats,"tax");
					    dini_IntSet(globalstats,"GovernmentBank",dini_Int(globalstats,"GovernmentBank")+tax);
					    new totalpt = PlayerInfo[i][playertime] + PlayerInfo[i][fpay] - PlayerInfo[i][rentprice] - tax;
			    		GivePlayerMoneyEx(i,totalpt);
			    		if(PlayerInfo[i][housenum]!=-1 && PlayerInfo[i][rentprice]>0)
						{
							format(filename2,sizeof(filename2),"/Houses/Casa%d.txt",PlayerInfo[i][housenum]);
							dini_IntSet(filename2, "till", dini_Int(filename2,"till") + PlayerInfo[i][rentprice]);
			    		}
			   			GameTextForPlayer(i,"~w~Pay~p~Time",3000,1);
						PlayerInfo[i][playertime]=0;
						PlayerInfo[i][totalpayt]++;
						dUserSetINT(PlayerName(i)).("time",PlayerInfo[i][playertime]);
					}
					else SendClientMessage(i,COLOR_ORANGE,"[PayTime] You haven't played long enough for PayTime");
				}
				else SendClientMessage(i,COLOR_YELLOW,"[SERVER] You are not authed, no PayDay");
			}
		}
	}
	return 1;
}
Reply
#2

Anyone ?
Reply
#3

pls help
Reply
#4

pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("Pay", 1000*60*60, true, "d", playerid);
    return 1;
}

forward Pay(playerid);
public Pay(playerid)
{
    return GivePlayerMoney(playerid, 100000);
}
That will give 100000 every hour to the players..
Reply
#5

SetTimerEx("PayDay", 600000, true, "i", playerid); - 600000 mili sec. = 1 hour

And GivePlayerMoney..

I guess you need to use only those two codes
Reply
#6

Well the problem isn't that I am not getting paday oney. It's just that I am getting random paydays . Once I get 20k, 5k, 2k...
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)