I need help with this
#1

So i have my Robbank System the only problem is when a player rob the bank after 10mins robbing they will get the Cash but the cash wont save in the player and i need help if someone already rob the bank they can only rob the bank for 9hours please i need help about this

Код:
}
enum pInfo
{
     pCash,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
new alreadyrobbed[MAX_PLAYERS];
new robbing[MAX_PLAYERS];

forward bankrob(playerid);
forward robbedoff(playerid);
public bankrob(playerid)
{
    SendClientMessage(playerid, COLOR_WHITE, " Your finished robbing the bank, Run now");
    GivePlayerMoney(playerid, 350000);
    PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+350000;
    alreadyrobbed[playerid] = 1;
    robbing[playerid] = 0;
    SetTimerEx("robbedoff", 3600000, false, "i", playerid);
    SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
    SendClientMessageToAll(COLOR_GREEN, " It looks like the bankrobber got the cash.");
    SendClientMessageToAll(COLOR_GREEN, " The cops is currently waiting outside.");
    SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
    return 1;
}
public robbedoff(playerid)
{
    alreadyrobbed[playerid] = 0;
    SendClientMessage(playerid, COLOR_WHITE, " You can now rob the bank again");
    return 1;
}
CMD:robbank(playerid, params[])
{
	if(IsPlayerConnected(playerid))
	{
		if(robbing[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, " You are already robbing the bank, please slow down");
			return 1;
		}
		if(alreadyrobbed[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "You already robbed the bank! Wait 1 hour.");
			return 1;
		}
		if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2394.66, -1593.87, 785.62)) // Change X Y Z to the location you want
		{
			SendClientMessage(playerid, COLOR_GREY, " You are not at the bank !");
			return 1;
		}
		SendClientMessage(playerid, COLOR_REALRED, " You started to rob the bank, This will take 10 minutes");
		SetTimerEx("bankrob", 600000, false, "i", playerid);
		robbing[playerid] = 1;
		SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
		SendClientMessageToAll(COLOR_GREEN, " The bank is currently getting robbed.");
		SendClientMessageToAll(COLOR_GREEN, " We are currently waiting for the cops");
		SendClientMessageToAll(COLOR_GREEN, " We will report more when we get more information");
		SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
	}
	return 1;
Reply
#2

pawn Код:
CMD:robbank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][team] == TEAM_LVCOP || PlayerInfo[playerid][team] == TEAM_LSCOP || PlayerInfo[playerid][team] == TEAM_SWAT || PlayerInfo[playerid][team] == TEAM_ARMY || PlayerInfo[playerid][team] == TEAM_LVARMY) SendClientMessage(playerid, COLOR_RED, "You cannot use this command!");
    else
    {
        new rbank;
        rbank = random(5);
        if(GetPlayerWantedLevel(playerid) > 0)
        {
            SendClientMessage(playerid,COLOR_RED,"You must be innocent to rob The Bank");
            return 1;
        }
        if(CloseToBank(playerid) == 999)
        {
            SendClientMessage(playerid,COLOR_RED,"You can only rob the bank from the Transactions Checkpoint inside the bank");
            return 1;
        }
        if(BankRobbedRecently >=1 ) {
            SendClientMessage(playerid,COLOR_ERROR,"The Bank has been robbed recenty. Please wait");
            return 1;
        }
        if(GetPlayerWantedLevel(playerid) == 0 && PlayerInfo[playerid][team] != TEAM_LVCOP || PlayerInfo[playerid][team] != TEAM_LSCOP || PlayerInfo[playerid][team] != TEAM_SWAT || PlayerInfo[playerid][team] != TEAM_ARMY || PlayerInfo[playerid][team] != TEAM_LVARMY)
        {
            if(BankRobbedRecently == 1)
            {
                GameTextForPlayer(playerid, "~r~The Bank~n~~w~robbed recently~n~try again later",5000,5);
                return 1;
            }
            if(BankRobbedRecently == 0)
            {
                switch(rbank)
                {
                    case 2:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                    case 4:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                    case 5:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                }
                new rcash = random(100000);
                GivePlayerMoney(playerid,rcash);
                new str[128];
                format(str,sizeof(str),"~w~ROBBED~n~$%d",rcash);
                GameTextForPlayer(playerid,str,5000,3);
                new plwl = GetPlayerWantedLevel(playerid);
                SetPlayerWantedLevel(playerid, plwl +3);
                new pname[24];
                GetPlayerName(playerid, pname, 24);
                for(new i=0;i<GetMaxPlayers();i++)
                {
                    if(LawEnforcementRadio[i] == 1) {
                        format(str,sizeof(str),"DISPATCH: (BANK ROBBERY) %s(%d) has robbed LV City Bank",pname,playerid);
                        SendClientMessage(i,COLOR_ROYALBLUE,str);
                    }
                }
                format(str,sizeof(str),"%s(%d) has just robbed $%d from LV City Bank",pname,playerid,rcash);
                SendClientMessageToAll(COLOR_AQUA,str);
                BankRobbedRecently = 1;
                SetTimer("BankRobbedRecentlyTimer",45000,0);
                return 1;
            }
        }
        else
        {
            return 1;
        }
    }
    RecentCrime[playerid] += 200;
    return 1;
}
try this
Reply
#3

i got this error

Код:
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(54) : error 017: undefined symbol "team"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(64) : error 017: undefined symbol "CloseToBank"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(69) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(73) : error 017: undefined symbol "team"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(75) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(80) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(89) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(89) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(98) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(98) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(107) : error 017: undefined symbol "BankRobbedRecently"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(107) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(123) : error 017: undefined symbol "LawEnforcementRadio"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(123) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(123) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(123) : error 029: invalid expression, assumed zero
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(123) : fatal error 107: too many error messages on one line
Reply
#4

Add this to the top of your script:
Код:
new BankRobbedRecently = 0;
Reply
#5

And this after putting on it
do i need to add new team[MAX_PLAYERS];

Код:
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(55) : error 017: undefined symbol "team"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(65) : error 017: undefined symbol "CloseToBank"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(74) : error 017: undefined symbol "team"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(124) : error 017: undefined symbol "LawEnforcementRadio"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(124) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(124) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(124) : error 029: invalid expression, assumed zero
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(124) : fatal error 107: too many error messages on one line
Reply
#6

Top of the script:
Код:
new BankRobbedRecently = 0;
new team[MAX_PLAYERS];
The CMD:
Код:
CMD:robbank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][team] == TEAM_LVCOP || PlayerInfo[playerid][team] == TEAM_LSCOP || PlayerInfo[playerid][team] == TEAM_SWAT || PlayerInfo[playerid][team] == TEAM_ARMY || PlayerInfo[playerid][team] == TEAM_LVARMY) SendClientMessage(playerid, COLOR_RED, "You cannot use this command!");
    else
    {
        new rbank;
        rbank = random(5);
        if(GetPlayerWantedLevel(playerid) > 0)
        {
            SendClientMessage(playerid,COLOR_RED,"You must be innocent to rob The Bank");
            return 1;
        }
        if(BankRobbedRecently >=1 ) {
            SendClientMessage(playerid,COLOR_ERROR,"The Bank has been robbed recenty. Please wait");
            return 1;
        }
        if(GetPlayerWantedLevel(playerid) == 0 && PlayerInfo[playerid][team] != TEAM_LVCOP || PlayerInfo[playerid][team] != TEAM_LSCOP || PlayerInfo[playerid][team] != TEAM_SWAT || PlayerInfo[playerid][team] != TEAM_ARMY || PlayerInfo[playerid][team] != TEAM_LVARMY)
        {
            if(BankRobbedRecently == 1)
            {
                GameTextForPlayer(playerid, "~r~The Bank~n~~w~robbed recently~n~try again later",5000,5);
                return 1;
            }
            if(BankRobbedRecently == 0)
            {
                switch(rbank)
                {
                    case 2:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                    case 4:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                    case 5:
                    {
                        GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3);
                        new plwl = GetPlayerWantedLevel(playerid);
                        SetPlayerWantedLevel(playerid, plwl +1 );
                        BankRobbedRecently = 1;
                        SetTimer("BankRobbedRecentlyTimer",45000,0);
                        return 1;
                    }
                }
                new rcash = random(100000);
                GivePlayerMoney(playerid,rcash);
                new str[128];
                format(str,sizeof(str),"~w~ROBBED~n~$%d",rcash);
                GameTextForPlayer(playerid,str,5000,3);
                new plwl = GetPlayerWantedLevel(playerid);
                SetPlayerWantedLevel(playerid, plwl +3);
                new pname[24];
                GetPlayerName(playerid, pname, 24);
                for(new i=0;i<GetMaxPlayers();i++)
                {
                    if(team[i] == 1) {
                        format(str,sizeof(str),"DISPATCH: (BANK ROBBERY) %s(%d) has robbed LV City Bank",pname,playerid);
                        SendClientMessage(i,COLOR_ROYALBLUE,str);
                    }
                }
                format(str,sizeof(str),"%s(%d) has just robbed $%d from LV City Bank",pname,playerid,rcash);
                SendClientMessageToAll(COLOR_AQUA,str);
                BankRobbedRecently = 1;
                SetTimer("BankRobbedRecentlyTimer",45000,0);
                return 1;
            }
        }
        else
        {
            return 1;
        }
    }
    RecentCrime[playerid] += 200;
    return 1;
}
Reply
#7

Sorry dude, im totally noob i dunno what to do.

Код:
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(27) : error 017: undefined symbol "PlayerInfo"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(27) : warning 215: expression has no effect
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(27) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(27) : error 029: invalid expression, assumed zero
C:\DOCUME~1\rjemms45\Desktop\AKOSIE~1\Robbank.pwn(27) : fatal error 107: too many error messages on one line
ERROR -.-
Reply
#8

pawn Код:
RobbedPlyRecent[playerid] = 0;
beenrobbedrecently[playerid] = 0;
new RobbedPlyRecent[MAX_PLAYERS];
new beenrobbedrecently[MAX_PLAYERS];
new BankRobbedRecently;
new RecentCrime[MAX_PLAYERS];
SetTimer("RobbedPlayerRecent",60040,1);
try to add those
Reply
#9

pawn Код:
enum pInfo
{
    team
};
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)