Advertisement
Guest User

Sistema de Banco por FreeGells

a guest
Aug 5th, 2011
4,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.38 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Dini>
  3.  
  4. public OnFilterScriptInit()
  5. {
  6.     print("\n--------------------------------------");
  7.     print(" Sistema de Banco Por FreeGells\n");
  8.     print(" Carregando...\n");
  9.     print("--------------------------------------\n");
  10.     Create3DTextLabel("Banco", -1, 2316.6208,-9.7189,26.7422, 20,0);
  11.     return 1;
  12. }
  13.  
  14.  
  15. public OnFilterScriptExit()
  16. {
  17.     print("\n--------------------------------------");
  18.     print(" Sistema de Banco Por FreeGells\n");
  19.     print(" Descarregando...\n");
  20.     print("--------------------------------------\n");
  21.     return 1;
  22. }
  23.  
  24.  
  25. public OnPlayerCommandText(playerid, cmdtext[])
  26. {
  27.     new cmd[256], idx, tmp[256], Arquivo[256], Dinheiro, string[128];
  28.     cmd = strtok(cmdtext, idx);
  29.  
  30.     if(strcmp(cmd, "/depositar", true) == 0) {
  31.         if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
  32.         {
  33.             tmp = strtok(cmdtext, idx);
  34.             if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Use: /Depositar [Quantia]");
  35.             Dinheiro = strval(tmp);
  36.             if(GetPlayerMoney(playerid)<Dinheiro) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não tem está quantia!");
  37.             {
  38.                 if(GetPlayerMoney(playerid) >= Dinheiro) {
  39.                     new n[MAX_PLAYER_NAME];
  40.                     GetPlayerName(playerid, n, sizeof(n));
  41.                     format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
  42.  
  43.                     if(dini_Exists(Arquivo)) {
  44.                         dini_IntSet(Arquivo, "Saldo", dini_Int(Arquivo, "Saldo") +Dinheiro);
  45.                     }
  46.                     else if(!dini_Exists(Arquivo)) {
  47.                         dini_Create(Arquivo);
  48.                         dini_IntSet(Arquivo, "Saldo", Dinheiro);
  49.                     }
  50.                     format(string, sizeof(string), "[BANCO] Você depositou %d em sua conta, Saldo atual: %d", Dinheiro, dini_Int(Arquivo, "Saldo"));
  51.                     SendClientMessage(playerid, 0x5EAF03FF, string);
  52.                     GivePlayerMoney(playerid, -Dinheiro);
  53.                 }
  54.                 return 1;
  55.             }
  56.         }
  57.     }
  58.  
  59.     if(strcmp(cmd, "/sacar", true) == 0) {
  60.         if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
  61.         {
  62.             tmp = strtok(cmdtext, idx);
  63.             if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFAA,"[ERRO] Use: /Sacar [Quantia]");
  64.             Dinheiro = strval(tmp);
  65.             {
  66.                 new n[MAX_PLAYER_NAME];
  67.                 GetPlayerName(playerid, n, sizeof(n));
  68.                 format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
  69.                 if(dini_Exists(Arquivo)) {
  70.                     if(dini_Int(Arquivo, "Saldo") < Dinheiro) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não tem está quantia no Banco!");
  71.                     else if(dini_Int(Arquivo, "Saldo") >= Dinheiro) {
  72.                         dini_IntSet(Arquivo, "Saldo", dini_Int(Arquivo, "Saldo") -Dinheiro);
  73.                         format(string, sizeof(string), "[BANCO] Você retirou %d de sua conta bancaria, Saldo atual %d", Dinheiro, dini_Int(Arquivo, "Saldo"));
  74.                         SendClientMessage(playerid, 0x5EAF03FF, string);
  75.                         GivePlayerMoney(playerid, Dinheiro);
  76.                     }
  77.                 }
  78.             }
  79.             return 1;
  80.         }
  81.     }
  82.  
  83.     if(strcmp(cmd, "/saldo", true) == 0) {
  84.         if(!IsPlayerInRangeOfPoint(playerid, 1.0, 2316.6208,-9.7189,26.7422)) return SendClientMessage(playerid, 0xFFFFFFAA, "[ERRO] Você não está no Banco!");
  85.         {
  86.             new n[MAX_PLAYER_NAME];
  87.             GetPlayerName(playerid, n, sizeof(n));
  88.             format(Arquivo, sizeof(Arquivo), "Banco/%s.txt", n);
  89.             if(dini_Exists(Arquivo)) {
  90.                 format(string, sizeof(string), "[BANCO] Seu Saldo atual é %d", dini_Int(Arquivo, "Saldo"));
  91.                 SendClientMessage(playerid, 0x5EAF03FF, string);
  92.             }
  93.             else if(!dini_Exists(Arquivo)) {
  94.                 SendClientMessage(playerid, 0x5EAF03FF, "[BANCO] Seu Saldo atual é 0");
  95.             }
  96.             return 1;
  97.         }
  98.     }
  99.  
  100.     if(strcmp(cmd, "/cbanco", true) == 0) {
  101.         SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Comandos Banco ~~~~~~~~~~~~~~~~~~~~~");
  102.         SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Saldo - Checa o Saldo Bancario");
  103.         SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Sacar [Quantia] - Saca a quantia desejada");
  104.         SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} /Depositar [Quantia] - Deposita a quantia desejada");
  105.         SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Comandos Banco ~~~~~~~~~~~~~~~~~~~~~");
  106.         return 1;
  107.     }
  108.    
  109.     if(strcmp(cmd, "/creditosb", true) == 0) {
  110.         SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Creditos Banco ~~~~~~~~~~~~~~~~~~~~~");
  111.         SendClientMessage(playerid, 0xFFFFFFAA, "{5EAF03}»{FFFFFF} Creditos a FreeGells pelo sistema de Banco!");
  112.         SendClientMessage(playerid, 0x5EAF03FF, "~~~~~~~~~~~~~~~~~~~~~ Creditos Banco ~~~~~~~~~~~~~~~~~~~~~");
  113.         return 1;
  114.     }
  115.     return 0;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement