help with my bank
#1

Hey, I just made a bank system for my GM but now I need to know how to get it to work whenever a player is in a correct interior, this is what I got so far:

pawn Код:
new BankInteriors[][] =
{
    18,4,6,17
};
pawn Код:
CMD:deposit(playerid,params[])
{
    if(GetPlayerInterior(playerid) == BankInteriors)
    {
        new ammount,pn[MAX_PLAYER_NAME],file[256],str[128];
        if(Logged[playerid] == 0) return SendClientMessage(playerid,WHITE,"You have to be logged in to use this");
        if(sscanf(params,"i",ammount))
        {
            SendClientMessage(playerid,WHITE,"USAGE: /deposit [AMMOUNT]");
            return 1;
        }
        if(ammount > GetPlayerMoney(playerid) || ammount <= 0) return SendClientMessage(playerid,WHITE,"Invalid ammount");
        GetPlayerName(playerid,pn,sizeof(pn));
        format(file,sizeof(file),"NewAdmin/Users/%s",pn);
        BMoney[playerid] += ammount;
        format(str,sizeof(str),"You have just deposited $%d into your account, your current balance is $%d",ammount,BMoney[playerid]);
        SendClientMessage(playerid,LIMEGREEN,str);
        dini_IntSet(file,"BMoney",BMoney[playerid]);
        GivePlayerMoney(playerid,-ammount);
       
    }
    else
    {
        SendClientMessage(playerid,WHITE,"You are not at a bank");
        return 1;
    }
}
and my error:
Код:
gamemodes\CoolGamemode.pwn(810) : error 033: array must be indexed (variable "BankInteriors")
Reply
#2

It might be better for you to use IsPlayerInRangeOfPoint(...).

But, try adding brackets around your interior values.
Reply
#3

I just tried the brackets and they didn't work
Reply
#4

then it will probably be easier for you just to use IsPlayerInRangeOfPoint(...).
Reply
#5

I would rather learn how to do it like this, and I dont want to have to go back in and go to all the interiors and do /save again

EDIT: Nevermind I just decided to do it the inefficient way

pawn Код:
if(GetPlayerInterior(playerid) == 18 ||
    GetPlayerInterior(playerid) == 4 ||
    GetPlayerInterior(playerid) == 6 ||
    GetPlayerInterior(playerid) == 17)
    {
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)