[HELP] /robbank Timer, how can i make one?
#1

Код:
	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
Reply
#2

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

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;
}
Reply
#4

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
Reply
#5

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.
Reply
#6

i still get those 2 errors,i don't get it
Reply
#7

Quote:

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

Quote:

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

Reply
#8

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
Reply
#9

Код:
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;
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)