Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new ATMData[MAX_PLAYERS][3];
- const ATM_DIALOG = 1;
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (!strcmp(cmdtext, "/atm", true))
- {
- ShowATMDialog(playerid);
- return 1;
- }
- if (!strcmp(cmdtext, "/account", true))
- {
- ShowAccountBalance(playerid);
- return 1;
- }
- return 0;
- }
- public ShowATMDialog(playerid)
- {
- ShowPlayerDialog(playerid, ATM_DIALOG, DIALOG_STYLE_INPUT, "Bankomat", "Zadejte částku, kterou chcete vložit nebo vybrat:", "Potvrdit", "Zrušit");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == ATM_DIALOG)
- {
- if (response)
- {
- new Float:amount = strtofloat(inputtext);
- if (amount > 0)
- {
- if (listitem == 0)
- {
- // Vkládání peněz
- GivePlayerMoney(playerid, amount);
- SendClientMessage(playerid, COLOR_GREEN, "Úspěšně jste vložili peníze do banky.");
- }
- else
- {
- // Vybrání peněz
- if (GetPlayerMoney(playerid) >= amount)
- {
- GivePlayerMoney(playerid, -amount);
- SendClientMessage(playerid, COLOR_GREEN, "Úspěšně jste vybrali peníze z banky.");
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "Nemáte dostatek peněz na účtu.");
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "Zadejte platnou částku.");
- }
- }
- return 1;
- }
- return 0;
- }
- public ShowAccountBalance(playerid)
- {
- new Float:balance = GetPlayerMoney(playerid);
- format(string, sizeof(string), "Stav vašeho účtu: $%.2f", balance);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement