Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Banco Por FreeGells\n");
- print(" Carregando...\n");
- print("--------------------------------------\n");
- Create3DTextLabel("Banco", -1, 2316.6208,-9.7189,26.7422, 20,0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Banco Por FreeGells\n");
- print(" Descarregando...\n");
- print("--------------------------------------\n");
- DOF2_Exit ();
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256], idx, tmp[256], Arquivo[256], Dinheiro, string[128];
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/depositar", true) == 0) {
- if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Use: /Depositar [Quantia]");
- Dinheiro = strval(tmp);
- if(GetPlayerMoney(playerid)<Dinheiro) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não tem está quantia!");
- {
- if(GetPlayerMoney(playerid) >= Dinheiro) {
- new n[MAX_PLAYER_NAME];
- GetPlayerName(playerid, n, sizeof(n));
- format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
- if(DOF2_FileExists(Arquivo)) {
- DOF2_SetInt(Arquivo, "Saldo", DOF2_GetInt(Arquivo, "Saldo") +Dinheiro);
- }
- else if(!DOF2_FileExists(Arquivo)) {
- DOF2_CreateFile(Arquivo);
- DOF2_SetInt(Arquivo, "Saldo", Dinheiro);
- }
- format(string, sizeof(string), "[BANCO] Você depositou %d em sua conta, Saldo atual: %d", Dinheiro, DOF2_GetInt(Arquivo, "Saldo"));
- SendClientMessage(playerid, 0x5EAF03FF, string);
- GivePlayerMoney(playerid, -Dinheiro);
- }
- return 1;
- }
- }
- }
- if(strcmp(cmd, "/sacar", true) == 0) {
- if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
- {
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA,"[ERRO] Use: /Sacar [Quantia]");
- Dinheiro = strval(tmp);
- {
- new n[MAX_PLAYER_NAME];
- GetPlayerName(playerid, n, sizeof(n));
- format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
- if(DOF2_FileExists(Arquivo)) {
- if(DOF2_GetInt(Arquivo, "Saldo") < Dinheiro) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não tem está quantia no Banco!");
- else if(DOF2_GetInt(Arquivo, "Saldo") >= Dinheiro) {
- DOF2_SetInt(Arquivo, "Saldo", DOF2_GetInt(Arquivo, "Saldo") -Dinheiro);
- format(string, sizeof(string), "[BANCO] Você retirou %d de sua conta bancaria, Saldo atual %d", Dinheiro, DOF2_GetInt(Arquivo, "Saldo"));
- SendClientMessage(playerid, 0x5EAF03FF, string);
- GivePlayerMoney(playerid, Dinheiro);
- }
- }
- }
- return 1;
- }
- }
- if(strcmp(cmd, "/saldo", true) == 0) {
- if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
- {
- new n[MAX_PLAYER_NAME];
- GetPlayerName(playerid, n, sizeof(n));
- format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
- if(DOF2_FileExists(Arquivo)) {
- format(string, sizeof(string), "[BANCO] Seu Saldo atual é %d", DOF2_GetInt(Arquivo, "Saldo"));
- SendClientMessage(playerid, 0x5EAF03FF, string);
- }
- else if(!DOF2_FileExists(Arquivo)) {
- SendClientMessage(playerid, 0x5EAF03FF, "[BANCO] Seu Saldo atual é 0");
- }
- return 1;
- }
- }
- if(strcmp(cmd, "/cbanco", true) == 0) {
- SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Comandos Banco ~~~~~~~~~~~~~~~~~~~~~");
- SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Saldo - Checa o Saldo Bancario");
- SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Sacar [Quantia] - Saca a quantia desejada");
- SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Depositar [Quantia] - Deposita a quantia desejada");
- SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Comandos Banco ~~~~~~~~~~~~~~~~~~~~~");
- return 1;
- }
- if(strcmp(cmd, "/creditosb", true) == 0) {
- SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Creditos Banco ~~~~~~~~~~~~~~~~~~~~~");
- SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} Creditos a FreeGells pelo sistema de Banco!");
- SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Creditos Banco ~~~~~~~~~~~~~~~~~~~~~");
- return 1;
- }
- return 0;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement