SA-MP Forums Archive
+rep for any 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: +rep for any help! (/showthread.php?tid=582258)



+rep for any help! - ironmen - 19.07.2015

Hey!
I was making bank time system like if the time is 13 and player in bank it gives the player money and sends client message to him!
i made it with public and forwarded the callback it compiles without any error but when i try it , it dont give me money or send client message!
Code:
Код:
forward OnPlayerInBank(playerid);
public OnPlayerInBank(playerid)
{
	new hour, minutes;
	GetPlayerTime(playerid, hour, minutes);
	if(inbank[playerid] == 1)
	{
  		if(hour == 13 && minutes == 00)
		{
	     	SendClientMessage(playerid, COLOR_WHITE, "The bank paid you 15 DCash!");
	     	GivePlayerMoney(playerid, 15);
		}
	}
	return 1;
}
Please help me!
I will +rep for any help!
Thanks!
Ironmen


Re: +rep for any help! - SoFahim - 19.07.2015

if(inbank[playerid] == 1) . That mean from 13:00 to 13:01 the player need to be in the bank. Unless he will not get that


Re : +rep for any help! - KillerDVX - 19.07.2015

PHP код:
forward OnPlayerInBank(playerid);
public 
OnPlayerInBank(playerid)
{
    new 
hourminutes;
    
GetPlayerTime(playeridhourminutes);
    if(
inbank[playerid] == 1)
    {
          if(
hour == 13 && minutes == 00)
        {
                   foreach(new 
i:Player)
                    {
                    
SendClientMessage(iCOLOR_WHITE"The bank paid you 15 DCash!");
                    
GivePlayerMoney(i15);
                    }
        }
    }
    return 
1;




Re: Re : +rep for any help! - ironmen - 19.07.2015

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
PHP код:
forward OnPlayerInBank(playerid);
public 
OnPlayerInBank(playerid)
{
    new 
hourminutes;
    
GetPlayerTime(playeridhourminutes);
    if(
inbank[playerid] == 1)
    {
          if(
hour == 13 && minutes == 00)
        {
                   foreach(new 
i:Player)
                    {
                    
SendClientMessage(iCOLOR_WHITE"The bank paid you 15 DCash!");
                    
GivePlayerMoney(i15);
                    }
        }
    }
    return 
1;

Thanks but didn't work!
----------------------------------------------------------------------
SoFahim
if(inbank[playerid] == 1) means that player entered the bank with /enter
look!
Код:
CMD:enter(playerid, params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 2, 1414.1307,-1487.2390,20.4345))//bank
	{
		SetPlayerPos(playerid, 344.6933,178.1691,1014.1875);
		SetPlayerInterior(playerid, 3);
		inbank[playerid] = 1;
 	}
	return 1;
}



Re : +rep for any help! - KillerDVX - 19.07.2015

You're having minutes == 0, that means if the payer's not in the bank at the exact time, he won't getting anything.


Re: +rep for any help! - ironmen - 19.07.2015

i wait at the bank from 12:30
What to do?!?!
Please help!


Re: +rep for any help! - Krokett - 19.07.2015

How do you call OnPlayerInBank? It seems you need a timer so it can check every second.


Re: +rep for any help! - ironmen - 19.07.2015

krokett how to check it every second?


Re: +rep for any help! - PrinceKumar - 19.07.2015

inbank[playerid] == 1
check this is it equal to 1 when you are in bank and also check have you called your function ?

Quote:
Originally Posted by ironmen
Посмотреть сообщение
krokett how to check it every second?
Just use settimer("function_name",duration in ms,true); to check it for every second


Re: +rep for any help! - Glenn332 - 19.07.2015

If you didnt make a timer you need to enter the bank at that exact time :P