help with my bank - 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 with my bank (
/showthread.php?tid=174230)
help with my bank -
mrcoolballs - 05.09.2010
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")
Re: help with my bank -
Toni - 05.09.2010
It might be better for you to use IsPlayerInRangeOfPoint(...).
But, try adding brackets around your interior values.
Re: help with my bank -
mrcoolballs - 05.09.2010
I just tried the brackets and they didn't work
Re: help with my bank -
Toni - 05.09.2010
then it will probably be easier for you just to use IsPlayerInRangeOfPoint(...).
Re: help with my bank -
mrcoolballs - 05.09.2010
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)
{