09.06.2010, 21:21
Hello.
I want to make an own bank-command and so i scripted something.
But when i type /bank help or something and im not in range of an atm i get message "unknown command"
What did i do wrong?
//EDIT:
Forgot to say:
I get no compile Errors and when im near an ATM i can use the commands but when i want to deposit or withdraw the program doesnt care about the number i want to withdraw and only withdraw 105$ and nothing other.
everytime i try it deposits/withdraws 105$
you know why?
I want to make an own bank-command and so i scripted something.
But when i type /bank help or something and im not in range of an atm i get message "unknown command"
What did i do wrong?
pawn Код:
CMD:bank(playerid, params[])
{
new string[256];
new poldmoney;
new pnewmoney;
new pcount;
for (new i=0; i<=sizeof(ATM); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 4.0, ATMC[i][X], ATMC[i][Y], ATMC[i][Z]))
{
if (!sscanf(params, "sd", params[0], params[1]))
{
SendClientMessage(playerid, RED, "SERVER: USAGE: /bank [Befehl] [ggf. ID] [Menge]");
}
else if (!strcmp(params[0], "help", true))
{
SendClientMessage(playerid, RED, "----------ATM----------");
SendClientMessage(playerid, GREEN, "- /bank einzahlen [Summe]");
SendClientMessage(playerid, RED, "--------------------------");
}
else if (!strcmp(params[0], "einzahlen", true))
{
if (params[1] >= GetPlayerMoney(playerid))
{
SendClientMessage(playerid, RED, "SERVER: Du hast nicht so viel Geld");
}
else if (params[1] <= 0)
{
SendClientMessage(playerid, RED, "SERVER: Du kannst nicht weniger als 0$ einzahlen");
}
else
{
poldmoney = Player[playerid][Guthaben];
new pmoney = -params[1];
Player[playerid][Money] = Player[playerid][Money] - params[1];
Player[playerid][Guthaben] = Player[playerid][Guthaben] + params[1];
GivePlayerMoney(playerid, pmoney);
pnewmoney = Player[playerid][Guthaben];
format(string, sizeof(string), "Alter Kontostand: %d$", poldmoney);
SendClientMessage(playerid, GREEN, string);
format(string, sizeof(string), "Neuer Kontostand: %d$", pnewmoney);
SendClientMessage(playerid, GREEN, string);
format(string, sizeof(string), "Du hast %d$ eingezahlt", pmoney);
SendClientMessage(playerid, GREEN, string);
}
}
else if (!strcmp(params[0], "abheben", true))
{
if (params[1] >= Player[playerid][Guthaben])
{
SendClientMessage(playerid, RED, "SERVER: So viel Geld hast du nicht auf deinem Konto");
}
else if (params[1] <= 0)
{
SendClientMessage(playerid, RED, "SERVER: Du kannst nicht weniger als 0$ abheben");
}
else
{
poldmoney = Player[playerid][Guthaben];
new pmoney = params[1];
Player[playerid][Money] = Player[playerid][Money] + params[1];
Player[playerid][Guthaben] = Player[playerid][Guthaben] - params[1];
GivePlayerMoney(playerid, pmoney);
pnewmoney = Player[playerid][Guthaben];
format(string, sizeof(string), "Alter Kontostand: %d$", poldmoney);
SendClientMessage(playerid, GREEN, string);
format(string, sizeof(string), "Neuer Kontostand: %d$", pnewmoney);
SendClientMessage(playerid, GREEN, string);
format(string, sizeof(string), "Du hast %d$ eingezahlt", params[1]);
SendClientMessage(playerid, GREEN, string);
}
}
return 0;
}
}
if (pcount <= 0)
{
SendClientMessage(playerid, RED, "SERVER: Du bist an keinem ATM");
}
return 1;
}
Forgot to say:
I get no compile Errors and when im near an ATM i can use the commands but when i want to deposit or withdraw the program doesnt care about the number i want to withdraw and only withdraw 105$ and nothing other.
everytime i try it deposits/withdraws 105$
you know why?