Ichigo Posted January 26, 2013 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 99 Reputation: 11 Joined: 01/22/13 Last Seen: June 7, 2023 Share Posted January 26, 2013 (edited) Aquí les traigo como añadir un poco de seguridad a los almacenes de guild.Primero en el src\map\atcommand.cBuscamos: ACMD_FUNC(guildstorage) { nullpo_retr(-1, sd); if (!sd->status.guild_id) { clif_displaymessage(fd, msg_txt(sd,252)); return -1; } if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading) return -1; if (sd->state.storage_flag == 1) { clif_displaymessage(fd, msg_txt(sd,250)); return -1; } if (sd->state.storage_flag == 2) { clif_displaymessage(fd, msg_txt(sd,251)); return -1; } storage_guild_storageopen(sd); clif_displaymessage(fd, msg_txt(sd,920)); // Guild storage opened. return 0; } Y añadimos debajo:/*========================================= * gstorage Security System *-----------------------------------------*/ ACMD_FUNC(gstoragesecurity) { nullpo_retr(-1,sd); if( sd->npc_id || sd->vender_id || sd->buyer_id || sd->state.trading || sd->state.storage_flag ) return -1; npc_event(sd,"GstorageSecurity::OnGuild",0); return 0; } Luego, en el mismo documento buscamos:ACMD_DEF(unloadnpcfile), ACMD_DEF(cart), ACMD_DEF(mount2), Y al final añadimos:ACMD_DEF2("gstorage",gstoragesecurity), Compilamos, sino no funciona.Y cargamos el siguiente script:gstorage_security.txt- script GstorageSecurity -1,{ end; OnGuild: if (!query_sql("show columns from `guild` like 'gstorage_mode'",@ignore,@ignore,@ignore,@ignore,@ignore,@ignore)) { mes "Hubo un error de base de datos críticos. Please informar de ello a un GM!"; close; } if (!getcharid(2)) { mes "[Guild S.]"; mes "Lo sentimos, usted debe estar en un clan para utilizar esta función!"; close; } mes "[Guild S.]"; mes "¿Qué te gustaría hacer?"; next; switch(select("Usar guild Storage (500 zeny)","Ver configuración","Atras")) { case 1: goto L_UseGStorage; case 2: query_sql "select gstorage_mode,gstorage_pos,gstorage_password from `guild` where `guild_id` = "+getcharid(2),@mode,@pos,@password$; if (strcharinfo(0) == getguildmaster(getcharid(2))) { next; mes "[Guild S.]"; mes "Guild Storage modo de acceso está configurado para "+@mode[0]; mes "0= sin restricción de acceso"; mes "1= requisito Posición"; mes "2= protegidos por contraseña"; switch(select("Cambiar el modo","Establecer posición minima permitida","Establecer Contraseña","Atras")) { case 1: mes "Entre en el modo #"; input @temp; if (@temp < 0) set @temp, 0; if (@temp > 2) set @temp, 2; query_sql "update `guild` set gstorage_mode = "+@temp+" where guild_id = "+getcharid(2),@ignore; mes "Modo ajustado a "+@temp; next; goto OnGuild; case 2: mes "Introduzca la posición mínima"; input @temp; if (@temp < 1) set @temp, 1; if (@temp > 50) set @temp, 50; query_sql "update `guild` set gstorage_pos = "+@temp+" where guild_id = "+getcharid(2),@ignore; mes "Posición mínima establecida a "+@temp; next; goto OnGuild; case 3: mes "Introduzca la contraseña, introduzca un espacio para cancelar"; input @temp$; set @temp$, escape_sql(@temp$); if (@temp$ == " ") { next; goto OnGuild; } query_sql "update `guild` set gstorage_password = '"+escape_sql(@temp$)+"' where guild_id = "+getcharid(2),@ignore; mes "Contraseña establece a "+@temp$; next; goto OnGuild; case 4: next; goto OnGuild; } } else { query_sql "select gstorage_mode from `guild` where guild_id = "+getcharid(2),@mode; mes "[Guild S.]"; switch(@mode) { case 0: mes "Guild storage is not currently restricted."; break; case 1: mes "Guild storage is currently restricted by position."; break; case 2: mes "Guild storage is currently restricted via password."; break; } next; goto OnGuild; } case 3: close; } close; L_UseGStorage: if (strcharinfo(0) == getguildmaster(getcharid(2))) goto L_UseGStorageSkip; query_sql "select gstorage_mode,gstorage_pos,gstorage_password from `guild` where guild_id = "+getcharid(2),@mode,@pos,@password$; if (@mode[0] == 1) { query_sql "select position from `guild_member` where guild_id = "+getcharid(2)+" and char_id = "+getcharid(0),@current_pos; if (@current_pos[0] > (@pos[0] - 1)) { mes "[Guild S.]"; mes "Sorry, but you are not authorized to use guild storage."; close; } } if (@mode[0] == 2) { mes "[Guild S.]"; mes "The guild leader has instated password protected guild storage, please enter the password now."; input @pw$; if (@pw$ != @password$[0]) { next; mes "[Guild S.]"; mes "Sorry, that password is incorrect."; close; } } L_UseGStorageSkip: if(zeny < 500) { mes "[Guild S.]"; mes "Necesitas 500 zeny."; close; } close2; if(basicskillcheck() && getskilllv(1) < 6) goto L_nobasicskill; if(guildopenstorage() == 1) goto L_gmateusing; dispbottom "Guild Storage is now open."; set zeny, zeny - 500; end; L_nobasicskill: mes "[Kafra]"; mes "You need to have Basic Skill level of 6 to open Guild storage"; close; L_gmateusing: mes "[Kafra]"; mes "One of your Guildmates is currently using the guild storage"; mes "Please try again later"; close; } Espero que les sirva. Edited July 29, 2013 by Ichigo 1 Quote Link to comment Share on other sites More sharing options...
Chloe Posted July 29, 2013 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 04/08/13 Last Seen: January 23, 2019 Share Posted July 29, 2013 Hola, busque donde mismo indicas y solo me aparece el primer texto, pero el segundo nada, ¿Podrias subir tu atcomand.c? Quote Link to comment Share on other sites More sharing options...
jaBote Posted July 29, 2013 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 182 Reputation: 36 Joined: 01/26/12 Last Seen: October 6, 2021 Share Posted July 29, 2013 El lugar donde implementas un ACMD_FUNC en atcommand.c da realmente igual, siempre que no esté dentro de otro comando y se implemente después de la definición para dar a entender al compilador qué significa ACMD_FUNC realmente. Yo personalmente lo implementaría después del último comando, en estos momentos, suponiendo que tienes un rAthena actualizado lo haría después de langtype (o sea, después de la llave de cierre que termina el código de dicho comando). Luego el resto de la implementación del comando debería ser normal, aunque la definición del comando (eso de ACMD_DEF2), lo pondría al final de su respectiva lista también, esa en que están ACMD_DEF y ACMD_DEF2 juntos. Por cierto, dado que esta modificación de source ya tiene un tiempo cabe la posibilidad de que no funcione en una versión actual de rAthena, pero si realmente quieres implementarlo sí merece la pena intentarlo. Aunque en realidad no sea muy bueno con el source no veo ningún motivo por el que no debería funcionar. Quote Link to comment Share on other sites More sharing options...
Ichigo Posted July 29, 2013 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 99 Reputation: 11 Joined: 01/22/13 Last Seen: June 7, 2023 Author Share Posted July 29, 2013 (edited) Es como dice jaBote, la función se puede implementar en otro orden, preferiblemente bajo de la última. Y si, no hay conflicto con las revisiones actuales de rAthena. PD: Actualice el post usando la función ACMD_FUNC(guildstorage), que si esta activa. Edited July 29, 2013 by Ichigo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.