10.08.2014, 00:25
recien abri el log y vi que un user pone mucha veces /depostar 1 y tambien en chat ar 1 creo que lo que hacen es sobrecargar los .log y ahi es cuando servidor se cae asi que nesesito un timer para mi /depositar /sacar y /transferir
dejo los cmds aqui
tengo un timer de /pagar pero nose ponerselo al /sacar y los otros
dejo los cmds aqui
Quote:
zcmd(sacar, playerid, params[]){ if(!gPlayerLogged{playerid}) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs logeado!"); if(IsAtATM(playerid)){ new money; if(sscanf(params, "d", money)) return SendClientMessageEx(playerid, COLOR_GRAD2, "Utiliza: /sacar [cantidad]"); if(money > Info[playerid][pAccount] || money < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "Cantidad incorrecta"); if(money < 0) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes retirar menos de 0."); new string[64]; Earn(playerid,money); Info[playerid][pAccount]-= money+10; format(string, sizeof(string), " Extrajiste: $%d ($10 Comisiуn) - Nuevo Balance: $%d",money,Info[playerid][pAccount]); SendClientMessageEx(playerid, COLOR_WHITE, string); format(string, sizeof(string), "* %s hace una transacciуn bancaria.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); format(string, sizeof(string), "[RETIRO BANCO] - %s hizo un retiro de $%d.", GetPlayerNameEx(playerid), money); return 1; } else SendClientMessageEx(playerid, COLOR_GREY, "No estбs en un ATM/Banco!"); return 1; } zcmd(depositar, playerid, params[]){ if(!gPlayerLogged{playerid}) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs logeado!"); if(IsAtATM(playerid)){ new money; if (sscanf(params, "d", money)) return SendClientMessageEx(playerid, COLOR_GRAD2, "Utiliza: /depositar [cantidad]"); if (money > GetPlayerCash(playerid) || money < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "Cantidad incorrecta"); new string[64]; Bought(playerid,money); Info[playerid][pAccount]+=money+10; format(string, sizeof(string), " Depositaste: $%d ($10 Comisiуn) - Nuevo Balance: $%d",money,Info[playerid][pAccount]); SendClientMessageEx(playerid, COLOR_WHITE, string); format(string, sizeof(string), "* %s hace una transacciуn bancaria.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); format(string, sizeof(string), "[DEPOSITO BANCO] - %s hizo un depуsito de $%d.", GetPlayerNameEx(playerid), money); return 1; } else SendClientMessageEx(playerid, COLOR_GREY, "No estбs en un ATM/Banco!"); return 1; } zcmd(transferir, playerid, params[]){ new string[128], giveplayerid, money; if(!IsAtATM(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "No estбs en un ATM/Banco."); if(!sscanf(params, "dd", giveplayerid, money)){ if(money > Info[playerid][pAccount]) return SendClientMessageEx(playerid, COLOR_GRAD2, "Cantidad incorrecta."); if(money < 0) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes transferir menos de 0."); if (IsPlayerConnected(giveplayerid)){ if (GetPVarInt(playerid, "GiveMoneyTimer") > 0){ format(string, sizeof(string), "Tienes que esperar %d segundos despuйs de transferido dinero.", GetPVarInt(playerid, "GiveMoneyTimer")); SendClientMessageEx(playerid,COLOR_GREY,string); return 1; } SetPVarInt(playerid, "GiveMoneyTimer", 60); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PAYTIMER); Info[playerid][pAccount] -= money+10; Info[giveplayerid][pAccount] += money-10; format(string, sizeof(string), "* Has echo una transferencia de %d$ a %s", money, GetPlayerNameEx(giveplayerid)); SendClientMessageEx(playerid, COLOR_GRAD1, string); format(string, sizeof(string), "* Recibiste una transferencia de %d$ de %s", money, GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_GRAD1, string); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), "AdmWarning: %s hizo una transferencia de $%d a %s", GetPlayerNameEx(playerid), money, GetPlayerNameEx(giveplayerid)); ABroadCast(COLOR_YELLOW,string,2); format(string, sizeof(string), "[TRANSFER BANCO] - %s hizo una transferencia de $%d a %s.", GetPlayerNameEx(playerid), money, GetPlayerNameEx(giveplayerid)); } else SendClientMessageEx(playerid, COLOR_GREY, "Jugador desconectado."); } else SendClientMessageEx(playerid, COLOR_GREY, "* /transferir <jugador> <cantidad>"); return 1; } |
Quote:
zcmd(pagar, playerid, params[]) { new string[128]; if(Info[playerid][pJailed] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes usar esto aquн."); if(!sscanf(params, "di", params[0], params[1])){ if(params[1] > GetPlayerCash(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "No posees esa cantidad."); if(params[1] < 1 || params[1] > 100000) return SendClientMessageEx(playerid, COLOR_GRAD2, "Mбximo: $100k"); if(IsPlayerConnected(params[0])){ if (GetPVarInt(playerid, "GiveMoneyTimer") > 0){ format(string, sizeof(string), "Tienes que esperar %d segundos despuйs de pagado.", GetPVarInt(playerid, "GiveMoneyTimer")); SendClientMessageEx(playerid,COLOR_GREY,string); return 1; }if(ProxDetectorS(5.0, playerid, params[0])){ SetPVarInt(playerid, "GiveMoneyTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_PAYTIMER); Bought(playerid, params[1]); Earn(params[0], params[1]); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(params[0], 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), "* %s saca un poco de dinero (%d$) y se lo da a %s", GetPlayerNameEx(playerid), params[1], GetPlayerNameEx(params[0])); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); format(string, sizeof(string), "* %s pagу %d$ a %s", GetPlayerNameEx(playerid), params[1], GetPlayerNameEx(params[0])); Log("logs/pagos.log", string); }else SendClientMessageEx(playerid, COLOR_GRAD2, "Jugador muy lejos."); }else SendClientMessageEx(playerid, COLOR_GRAD2, "Esa ID es invбlida."); }else SendClientMessageEx(playerid, COLOR_GRAD2, "* /pagar <jugador> <cantidad>"); return 1; } |