SA-MP Forums Archive
Help payday - 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: Help payday (/showthread.php?tid=521972)



Help payday - Fjclip99 - 25.06.2014

I have another problem

I have payday every full hour...
Now on payday it will check if player was playing 20 + min. if yes - he gets the payday, if not - he gets the message that he wasn't playing enough and don't get the payday. Now if i am the only player on the server it works fine, but if there are more, some of theme gets the both (The payday and the message that they haven't played enough...)
Script:
Код:
forward paytime(playerid);
public paytime(playerid)
{
    new hh, mm, ss;
    gettime( hh, mm, ss );
    if( mm == 00 )
    {
   		for(new i = 0;i < MAX_PLAYERS;i += 1)
	        {
	        SetPlayerTime(i,hh,00);
	        if(pInfo[i][Paytime] >= 2) // If player have been playing for 20+ minutes, he gets payday.
	        {
			GivePlayerMoney(i, pInfo[i][Placa]);
			pInfo[i][EXP] ++;
			pInfo[i][Phours] ++;
			pInfo[i][Paytime] = 0;
			new string[128];
			format(string,sizeof(string),""red"[BANKA]"white" Plača je bila izplačana, na vaљ račun je nakazano: $ %i.",pInfo[i][Placa]);
		    	SendClientMessage(i, COLOR_RED,"------------------------------------------------");
		    	SendClientMessage(i, COLOR_WHITE,string);
		    	SendClientMessage(i, COLOR_RED,"------------------------------------------------");
		    	pInfo[i][Placa] = 500;
	   		TextDrawHideForPlayer(i,exps[i]);
			new expsstr[124];
			format(expsstr, sizeof(expsstr), "-     Experiance:  %i / %i", pInfo[i][EXP],pInfo[i][ExpNext]);
			TextDrawSetString(exps[i], expsstr);
			TextDrawShowForPlayer(i, exps[i]);
		}
		else return SendClientMessage(playerid, COLOR_WHITE, ""red"[BANKA]"white"Niste igrali dovolj dolgo, da bi dobili plačo."); // If player was not playing 20+ minutes, he gets the message.
		}
	}
    return 1;
}



Re: Help payday - WardenCS - 25.06.2014

How do you give the paytime?


Re: Help payday - Beckett - 25.06.2014

How do you collect the paytime?


Re: Help payday - Fjclip99 - 25.06.2014

Код:
forward paytimeplus(playerid);
public paytimeplus(playerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
	{
		pInfo[i][Paytime] ++;
	}
    return 1;
}
This is a 20 mins. Timer


Re: Help payday - Fjclip99 - 25.06.2014

Every 10 mins. Sorry


Re: Help payday - Fjclip99 - 25.06.2014

Anyone help ?


Re: Help payday - WardenCS - 25.06.2014

how do you set paytimeplus timer?


Re: Help payday - Fjclip99 - 25.06.2014

OnFilterScriptInit:
http://prntscr.com/3wfodq
Timer:
http://prntscr.com/3wfolu


Re: Help payday - WardenCS - 25.06.2014

Код:
onplayerconnect:
SetTimerEx("paytimeplus", 600000, true, "i", playerid);

forward paytimeplus(playerid);
public paytimeplus(playerid)
{
	 if(IsPlayerConnected(playerid))
	{
		pInfo[playerid][Paytime] ++;
	}
    return 1;
}