SA-MP Forums Archive
[HELP] /robbank Timer, how can i make one? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] /robbank Timer, how can i make one? (/showthread.php?tid=76911)



[HELP] /robbank Timer, how can i make one? - marszim - 07.05.2009

Код:
	if(strcmp(cmd, "/robbank", true) == 0)
	{
    if(PlayerInfo[playerid][pLocal] == 103)
		{
			if(PlayerInfo[playerid][pRobTime] == 1)
			{
		    SendClientMessage(playerid, COLOR_YELLOW, "You cannot rob the Bank more then once per day(1 Hour)!");
			}
			if(PlayerInfo[playerid][pRobTime] == 0)
		  {
				GetPlayerName(playerid, sendername, sizeof(sendername));
     		SendClientMessage(playerid, 0xFF0000FF, " You Have Robbed The Bank ");
				CP[playerid] = 2;
				format(string, sizeof(string), "** HQ: The Bank in Los Angeles has been robbed by %s!!. **", sendername);
				SendRadioMessage(1, TEAM_BLUE_COLOR, string);
				SendRadioMessage(2, TEAM_BLUE_COLOR, string);
				SendRadioMessage(3, TEAM_BLUE_COLOR, string);
				WantedPoints[playerid] +=4; SetPlayerCriminal(playerid,255, "Robbing the Bank!");
				format(string,sizeof(string), "* %s points his gun at the clerk and attempts to rob the Bank.", sendername);
				SendClientMessage(playerid, COLOR_YELLOW, "You have been seen on the security cameras! Run away!");
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
 			}
		}
		return 1;
	}
How can i make it so you can only rob it once per day (1 hour IRL)

Could you explain, and show me how at the same time for me?

Thanks


Re: [HELP] /robbank Timer, how can i make one? - Hrvo182 - 16.09.2009

yeah i would like to know that too,i can't figure it out


Re: [HELP] /robbank Timer, how can i make one? - DMSOrg - 16.09.2009

in your forwards:

pawn Код:
forward EnableBank(playerid);
the edit to /robbank:

pawn Код:
if(strcmp(cmd, "/robbank", true) == 0)
    {
    if(PlayerInfo[playerid][pLocal] == 103)
        {
            if(PlayerInfo[playerid][pRobTime] == 1)
            {
            SendClientMessage(playerid, COLOR_YELLOW, "You cannot rob the Bank more then once per day(1 Hour)!");
            }
            if(PlayerInfo[playerid][pRobTime] == 0)
          {
                GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, 0xFF0000FF, " You Have Robbed The Bank ");
                CP[playerid] = 2;
                format(string, sizeof(string), "** HQ: The Bank in Los Angeles has been robbed by %s!!. **", sendername);
                SendRadioMessage(1, TEAM_BLUE_COLOR, string);
                SendRadioMessage(2, TEAM_BLUE_COLOR, string);
                SendRadioMessage(3, TEAM_BLUE_COLOR, string);
                WantedPoints[playerid] +=4; SetPlayerCriminal(playerid,255, "Robbing the Bank!");
                format(string,sizeof(string), "* %s points his gun at the clerk and attempts to rob the Bank.", sendername);
                SendClientMessage(playerid, COLOR_YELLOW, "You have been seen on the security cameras! Run away!");
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                new TimerBankStack = SetTimer("EnableBank", 3600000, 0, "i", playerid);
            }
        }
        return 1;
    }
And anywhere outside of a callback:

pawn Код:
public EnableBank(playerid);
{
 PlayerInfo[playerid][pRobTime] == 0
 KillTimer(TimerBankStack);
 return 1;
}



Re: [HELP] /robbank Timer, how can i make one? - Hrvo182 - 16.09.2009

Quote:
Originally Posted by [K4L
Jake ]

And anywhere outside of a callback:

pawn Код:
public EnableBank(playerid);
{
 PlayerInfo[playerid][pRobTime] == 0
 KillTimer(TimerBankStack);
 return 1;
}
i get 2 errors:

Код:
C:\Users\User\Desktop\MyServer\gamemodes\roleplay.pwn(758) : error 055: start of function body without function header
C:\Users\User\Desktop\My Server\gamemodes\roleplay.pwn(761) : error 010: invalid function or declaration



Re: [HELP] /robbank Timer, how can i make one? - Calgon - 16.09.2009

Quote:
Originally Posted by Hrvo182
Quote:
Originally Posted by [K4L
Jake ]

And anywhere outside of a callback:

pawn Код:
public EnableBank(playerid);
{
 PlayerInfo[playerid][pRobTime] == 0
 KillTimer(TimerBankStack);
 return 1;
}
i get 2 errors:

Код:
C:\Users\User\Desktop\MyServer\gamemodes\roleplay.pwn(758) : error 055: start of function body without function header
C:\Users\User\Desktop\My Server\gamemodes\roleplay.pwn(761) : error 010: invalid function or declaration
pawn Код:
public EnableBank(playerid);
{
  PlayerInfo[playerid][pRobTime] = 0;
  KillTimer(TimerBankStack);
  return 1;
}
A waste of coding disabling the timer when you could just set it to false to not repeat, but sure.. That will work.


Re: [HELP] /robbank Timer, how can i make one? - Hrvo182 - 16.09.2009

i still get those 2 errors,i don't get it


Re: [HELP] /robbank Timer, how can i make one? - mr.b - 17.09.2009

Quote:

public EnableBank(playerid) ;<----
{
PlayerInfo[playerid][pRobTime] = 0;
KillTimer(TimerBankStack);
return 1;
}

Quote:

public EnableBank(playerid)
{
PlayerInfo[playerid][pRobTime] = 0;
KillTimer(TimerBankStack);
return 1;
}




Re: [HELP] /robbank Timer, how can i make one? - Calgon - 17.09.2009

Quote:
Originally Posted by mr.b
Quote:

public EnableBank(playerid) ;<----
{
PlayerInfo[playerid][pRobTime] = 0;
KillTimer(TimerBankStack);
return 1;
}

Quote:

public EnableBank(playerid)
{
PlayerInfo[playerid][pRobTime] = 0;
KillTimer(TimerBankStack);
return 1;
}

Wow, how could I not notice.. xD


Re: [HELP] /robbank Timer, how can i make one? - Hrvo182 - 27.09.2009

Код:
C:\Users\User\Desktop\My Server\gamemodes\roleplay.pwn(2236) : error 010: invalid function or declaration
C:\Users\User\Desktop\My Server\gamemodes\roleplay.pwn(2240) : error 010: invalid function or declaration
that is this part:

Код:
public EnableBank(playerid) ;<----
{
  PlayerInfo[playerid][pRobTime] = 0;
  KillTimer(TimerBankStack);
  return 1;
}
those lines:

Код:
public EnableBank(playerid) ;<----
return 1;



Re: [HELP] /robbank Timer, how can i make one? - clover555 - 07.01.2010

excuse for dig this topic. But Which Bank. I want robbank script in sf.