Posted by Deathmanthys on Sun 2 Nov 05:21
report abuse | View followups from Anonymous | download | new post
- #include <a_samp>
- #include <dini>
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward ExtractParametersFromString(const string[], number, out[]);
- #define COLOR_AMARILLO 0xFFFF00
- #define COLOR_AZUL 0x0066FF
- #define COLOR_ROJO 0xFF3300
- #define COLOR_VERDEFLOJO 0x00FF00
- #define COLOR_NARANJA 0xFF9900
- #define COLOR_CELESTE 0x00FFFF
- #define COLOR_SYSTEM 0xEFEFF7AA
- #define COLOR_VERDE 0x00CC00
- #define COLOR_VERDEOSCURO 0x006600
- #define COLOR_BLANCO 0xFFFFFF
- #define COLOR_MARRON 0x996600
- #define COLOR_NEGRO 0x000000
- #define COLOR_AZULMARINO 0x0066CC
- #define COLOR_LILA 0xCC66FF
- #define COLOR_ROSA 0xFF66FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_VERDE1 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_PINK 0xFF66FFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_AQUA 0x00FFFFFF
- #define COLOR_AQUAGRN 0x7FFFD4FF
- #define COLOR_BLUEVILOT 0x8A2BE2FF
- #define COLOR_LTGREEN 0x7FFF00FF
- #define COLOR_DKGREEN 0x006400FF
- #define COLOR_GOLD 0xFFD700FF
- #define COLOR_GOLDENROD 0xDAA520FF
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_DARKRED 0x660000AA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_GREEN 0x33AA33AA
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------------");
- print("Banco\n");
- print("1.0");
- print("--------------------------------------------\n");
- return 1;
- }
- //------------------------------------------------------------------------------
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {//Public Enemy
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- return 0;
- }
- //------------------------------------------------------------------------------
- public ExtractParametersFromString(const string[], number, out[])
- new length = strlen(string);
- new indexStart = 0;
- new indexEnd = 0;
- new numParInStr = 0;
- out[0]=EOS;
- while ((numParInStr < number) && (indexEnd < length))
- {
- indexStart = indexEnd;
- while ((indexEnd < length) && (string[indexEnd] != ' '))
- {
- indexEnd++;
- }
- numParInStr++;
- if((numParInStr < number) && (indexEnd < length) && (string[indexEnd] == ' ')) indexEnd++;
- }
- if(numParInStr!=number) return 0;
- new offset = indexStart;
- for(new i=indexStart; i<indexEnd; i++)
- {
- out[i - offset] = string[i];
- }
- out[indexEnd-offset] = EOS;
- return 1;
- }
- //------------------------------------------------------------------------------
- public OnPlayerConnect(playerid)
- {
- new playername[256];
- GetPlayerName(playerid, playername, 256);
- new str[256];
- format(str,sizeof(str),"bank/%s", playername);
- if(dini_Exists(str))
- {
- print("wii cargó");
- }
- else
- {
- format(str,sizeof(str),"bank/%s", playername);
- if(!dini_Exists(str)) dini_Create(str);
- dini_IntSet(str, "bank",0);
- }
- return 1;
- }
- //------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- ExtractParametersFromString(cmdtext, 1, cmd);
- if(strcmp(cmd, "/depositar", true) == 0)
- {
- if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
- {
- new nummoney2[256];
- new nummoney;
- new oldmoney;
- new pmoney;
- new newmoney;
- new playername[256];
- new str[256];
- GetPlayerName(playerid, playername, 256);
- if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USO: /depositar [cantidad]");
- return 1;
- }
- else
- {
- nummoney = strval(nummoney2);
- }
- if(GetPlayerMoney(playerid) < nummoney)
- {
- SendClientMessage(playerid, COLOR_RED, "No tienes suficiente dinero");
- }
- else
- {
- format(str,sizeof(str),"bank/%s", playername);
- oldmoney = dini_Int(str,"bank");
- newmoney = nummoney+oldmoney;
- dini_IntSet(str, "bank",newmoney);
- pmoney = GetPlayerMoney(playerid);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, pmoney-nummoney);
- new string[256];
- format(string,sizeof(string),"Depositaste: %d$, ahora tienes %d$.",nummoney,newmoney);
- SendClientMessage(playerid,COLOR_GREEN,string);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "Debes estar en un ATM 24/7.");
- }
- return 1;
- }
- if(strcmp(cmd, "/retirar", true) == 0)
- {
- if(PlayerToPoint(100, playerid,827.9430,4.9825,1004.1870) || PlayerToPoint(100, playerid,212.6392,-8.1615,1001.2109) || PlayerToPoint(100, playerid,346.4020,172.5660,1014.1875) || PlayerToPoint(100, playerid,-2662.8271,1411.1824,906.2734) || PlayerToPoint(100, playerid,-26.9156,-55.3495,1003.5469))
- {
- new nummoney2[256];
- new nummoney;
- new oldmoney;
- new newmoney;
- new playername[256];
- new str[256];
- GetPlayerName(playerid, playername, 256);
- if(!ExtractParametersFromString(cmdtext, 2, nummoney2))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USO: /retirar [cantidad]");
- }
- else
- {
- nummoney = strval(nummoney2);
- }
- format(str,sizeof(str),"bank/%s", playername);
- oldmoney = dini_Int(str,"bank");
- if(oldmoney < nummoney)
- {
- SendClientMessage(playerid, COLOR_RED, "No tienes esa cantidad de dinero en tu cuenta");
- }
- else
- {
- newmoney = oldmoney-nummoney;
- dini_IntSet(str, "bank",newmoney);
- GivePlayerMoney(playerid, nummoney);
- new string[256];
- format(string,sizeof(string)," Ahora Tienes: %d$ en tu cuenta bancaria.", newmoney);
- SendClientMessage(playerid,COLOR_GREEN,string);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "No estas en un ATM 24/7.");
- }
- return 1;
- }
- if(strcmp(cmd, "/saldo", true) == 0)
- {
- new playername[256];
- new str[256];
- new money2;
- GetPlayerName(playerid, playername, 256);
- format(str,sizeof(str),"bank/%s", playername);
- money2 = dini_Int(str,"bank");
- format(str,sizeof(str)," Tu Dinero: %d$", money2);
- SendClientMessage(playerid, 0xF0F0F0FF, "Cuenta Bancaria:");
- SendClientMessage(playerid, COLOR_WHITE, str);
- return 1;
- }
- return 0;
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.