Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined Parka_Creditos
- -=Sistema Bancario=-
- -=Version 1.0=-
- -= 11/2013 =-
- -=Scripter By Parka=-
- -=Por favor no remover creditos=-
- Plagio: Copiar en lo sustancial obras ajenas, dándolas como propias.
- #endif
- #include <a_samp>
- #include <Dini>
- #pragma unused strtok
- #define Deposito 0b1010000
- #define Retiro 0b1010001
- new BancoInfo[MAX_PLAYERS];
- new ObtenerInformacion[MAX_PLAYERS];
- new PlayerText:BancoTextDraw[0b10];
- static CuentaBancaria(playerid){
- new string[0b100000],Name[0b11000];
- GetPlayerName(playerid,Name,sizeof(Name));
- format(string,sizeof(string),"%s.txt",Name);
- return string;
- }
- stock IsNumeric2(const string[]){
- // Is Numeric Check 2
- // ------------------
- // By DracoBlue... handles negative numbers
- new length=strlen(string);
- if (length==0) return false;
- for (new i = 0; i < length; i++)
- {
- if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.') // Not a number,'+' or '-' or '.'
- || (string[i]=='-' && i!=0) // A '-' but not first char.
- || (string[i]=='+' && i!=0) // A '+' but not first char.
- ) return false;
- }
- if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false;
- return true;
- }
- forward VerificarPosicion();
- public VerificarPosicion(){
- for(new i, t=GetMaxPlayers(); i<t; i++){
- if(!IsPlayerInCheckpoint(i)){
- if(IsPlayerInRangeOfPoint(i,8.0,2316.3550,-9.9246,26.7422)){
- SetPlayerCheckpoint(i,2316.3550,-9.9246,26.7422,1.0);
- ObtenerInformacion[i] = 0b1;
- return 0b1;
- }
- }
- }
- return 0b1;
- }
- public OnFilterScriptInit(){
- print("\n\t-=Sistema Bancario=- \
- \n\t-=Version 1.0=- \
- \n\t-=Scripter By Parka=- \
- \n\t-=Por favor no remover creditos=-\n\n\n");
- SetTimer("VerificarPosicion",1000,true);
- return 0b1;
- }
- public OnPlayerConnect(playerid){
- ObtenerInformacion[playerid] = 0b0;
- BancoInfo[playerid] = 0b0;
- if(dini_Exists(CuentaBancaria(playerid))){
- BancoInfo[playerid] = dini_Int(CuentaBancaria(playerid),"Dinero");
- }else{
- dini_Create(CuentaBancaria(playerid));
- dini_IntSet(CuentaBancaria(playerid),"Dinero",BancoInfo[playerid]);
- }
- BancoTextDraw[0b0] = CreatePlayerTextDraw(playerid,315.000000, 192.000000, "Depositar");
- PlayerTextDrawAlignment(playerid,BancoTextDraw[0b0], 2);
- PlayerTextDrawBackgroundColor(playerid,BancoTextDraw[0b0], 255);
- PlayerTextDrawFont(playerid,BancoTextDraw[0b0], 2);
- PlayerTextDrawLetterSize(playerid,BancoTextDraw[0b0], 0.390000, 1.200000);
- PlayerTextDrawColor(playerid,BancoTextDraw[0b0], -1);
- PlayerTextDrawSetOutline(playerid,BancoTextDraw[0b0], 1);
- PlayerTextDrawSetProportional(playerid,BancoTextDraw[0b0], 1);
- PlayerTextDrawUseBox(playerid,BancoTextDraw[0b0], 1);
- PlayerTextDrawBoxColor(playerid,BancoTextDraw[0b0], -205);
- PlayerTextDrawTextSize(playerid,BancoTextDraw[0b0], 20.000000, 94.000000);
- PlayerTextDrawSetSelectable(playerid,BancoTextDraw[0b0], 1);
- BancoTextDraw[0b1] = CreatePlayerTextDraw(playerid,315.000000, 210.000000, "Retirar");
- PlayerTextDrawAlignment(playerid,BancoTextDraw[0b1], 2);
- PlayerTextDrawBackgroundColor(playerid,BancoTextDraw[0b1], 255);
- PlayerTextDrawFont(playerid,BancoTextDraw[0b1], 2);
- PlayerTextDrawLetterSize(playerid,BancoTextDraw[0b1], 0.390000, 1.200000);
- PlayerTextDrawColor(playerid,BancoTextDraw[0b1], -1);
- PlayerTextDrawSetOutline(playerid,BancoTextDraw[0b1], 1);
- PlayerTextDrawSetProportional(playerid,BancoTextDraw[0b1], 1);
- PlayerTextDrawUseBox(playerid,BancoTextDraw[0b1], 1);
- PlayerTextDrawBoxColor(playerid,BancoTextDraw[0b1], -205);
- PlayerTextDrawTextSize(playerid,BancoTextDraw[0b1], 20.000000, 94.000000);
- PlayerTextDrawSetSelectable(playerid,BancoTextDraw[0b1], 1);
- return 0b1;
- }
- public OnPlayerDisconnect(playerid, reason){
- if(dini_Exists(CuentaBancaria(playerid))){
- dini_IntSet(CuentaBancaria(playerid),"Dinero",BancoInfo[playerid]);
- }
- return 0b1;
- }
- public OnPlayerCommandText(playerid, cmdtext[]){
- if(!strcmp("/banco",cmdtext)){
- SetPlayerPos(playerid,2305.8740,-16.1259,26.7496); GivePlayerMoney(playerid,100000);
- return 0b1;
- }
- return 0b1;
- }
- public OnPlayerEnterCheckpoint(playerid){
- if(ObtenerInformacion[playerid] == 0b1){
- SelectTextDraw(playerid,0xFFFF0055);
- PlayerTextDrawShow(playerid, BancoTextDraw[0b0]);
- PlayerTextDrawShow(playerid, BancoTextDraw[0b1]);
- return 0b1;
- }
- return 0b1;
- }
- public OnPlayerLeaveCheckpoint(playerid){
- if(ObtenerInformacion[playerid] == 0b1){
- ObtenerInformacion[playerid] = 0b0;
- CancelSelectTextDraw(playerid);
- PlayerTextDrawHide(playerid, BancoTextDraw[0b0]);
- PlayerTextDrawHide(playerid, BancoTextDraw[0b1]);
- DisablePlayerCheckpoint(playerid);
- return 0b1;
- }
- return 0b1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid){
- if(clickedid == Text:INVALID_TEXT_DRAW){
- PlayerTextDrawHide(playerid, BancoTextDraw[0b0]);
- PlayerTextDrawHide(playerid, BancoTextDraw[0b1]);
- return 1;
- }
- return 1;
- }
- public OnPlayerClickPlayerTextDraw(playerid,PlayerText:playertextid){
- if(playertextid == BancoTextDraw[0b0]){
- ShowPlayerDialog(playerid,Deposito,DIALOG_STYLE_INPUT,"Banco","Por favor ingrese la cantidad de dinero\nA Depositar en el siguiente espacio","Aceptar","Cancelar");
- for(new t;t<2;t++){PlayerTextDrawHide(playerid,BancoTextDraw[t]);}
- CancelSelectTextDraw(playerid);
- return 1;
- }
- if(playertextid == BancoTextDraw[0b1]){
- ShowPlayerDialog(playerid,Retiro,DIALOG_STYLE_INPUT,"Banco","Por favor ingrese la cantidad de dinero\nA Retirar en el siguiente espacio","Aceptar","Cancelar");
- for(new t;t<2;t++){PlayerTextDrawHide(playerid,BancoTextDraw[t]);}
- CancelSelectTextDraw(playerid);
- return 1;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- switch(dialogid){
- case Deposito:{
- if(response){
- new Valor = strval(inputtext);
- if(!IsNumeric2(inputtext)) return SendClientMessage(playerid,-1,"Error escribir solo numeros!");
- if(Valor > GetPlayerMoney(playerid)) return SendClientMessage(playerid,-1,"Error usted no tiene esa cantidad de dinero!");
- BancoInfo[playerid] += Valor;
- GivePlayerMoney(playerid,-Valor);
- new string[0b10000000];
- format(string,sizeof(string),"Usted deposito en su cuenta bancaria $%d ahora posee $%d en ella!",Valor,BancoInfo[playerid]);
- SendClientMessage(playerid,0xC0C0C0AA,string);
- }
- }
- case Retiro:{
- if(response){
- new Valor = strval(inputtext);
- if(!IsNumeric2(inputtext)) return SendClientMessage(playerid,-1,"Error escribir solo numeros!");
- if(Valor > BancoInfo[playerid]) return SendClientMessage(playerid,-1,"Error usted no tiene esa cantidad de dinero!");
- BancoInfo[playerid] -= Valor;
- GivePlayerMoney(playerid,Valor);
- new string[0b10000000];
- format(string,sizeof(string),"Usted retiro de su cuenta bancaria $%d ahora posee $%d en ella!",Valor,BancoInfo[playerid]);
- SendClientMessage(playerid,0xC0C0C0AA,string);
- }
- }
- }
- return 0b1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement