-
Posts
40 -
Joined
-
Last visited
Guih's Achievements

Poring (1/15)
0
Reputation
-
Thanks for answering Emistry, I changed the script as you suggested: - script dualclientkicker -1,{ OnPCLoadMapEvent: set .@charmap$, strcharinfo(3); if(!compare(.tmp$,.@charmap$)) end; set .@len, query_sql("select account_id from `char` right join login on login.account_id = `char`.account_id where `char`.online = 1 and login.last_mac = '"+ getcharmac() +"'",.@a ); //Annieruru Addition. if(.@len-1) { for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) { getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d])); if(.@charmap$==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) { dispbottom "Dual Client não disponível nesse mapa."; warp "vilasyn",91,54; } } } end; OnInit: setarray .maps$ , "aldeg_cas01", "gefg_cas01", "payg_cas01", "prtg_cas01", "guild_vs3"; set .lens , getarraysize(.maps$) ; for(set(.a,0);.a<.lens;set(.a,.a+1)) { setmapflag .maps$[.a], mf_loadevent ; set .tmp$ ,.tmp$+.maps$[.a]+","; } } But now I got this error: parse_callfunc: expected ')' to close argument list On this line and function: set .@len, query_sql("select account_id from `char` right join login on login.account_id = `char`.account_id where `char`.online = 1 and login.last_mac = '"+ getcharmac() +"'",.@a ); //Annieruru Addition. getcharmac() So i guess I'll have to use the other method you told me about, but how can I insert it into this NPC? Thanks.
-
Hello guys! So, i got this script from here and I need to do a few modifications that I've tried, but no success. This is the original script: - script dualclientkicker -1,{ OnPCLoadMapEvent: set .@charmap$, strcharinfo(3); if(!compare(.tmp$,.@charmap$)) end; set .@len, query_sql("select account_id from `char` right join login on login.account_id = `char`.account_id where `char`.online = 1 and login.last_ip = '"+ getcharip() +"'",.@a ); //Annieruru Addition. if(.@len-1) { for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) { getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d])); if(.@charmap$==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) { dispbottom "Dual Client não disponível nesse mapa."; warp "vilasyn",91,54; } } } end; OnInit: setarray .maps$ , "aldeg_cas01", "gefg_cas01", "payg_cas01", "prtg_cas01", "guild_vs3"; set .lens , getarraysize(.maps$) ; for(set(.a,0);.a<.lens;set(.a,.a+1)) { setmapflag .maps$[.a], mf_loadevent ; set .tmp$ ,.tmp$+.maps$[.a]+","; } } I'd like to make it look after the last_mac field instead of the last_ip field. And also, I have a separated login database, I tried this: query_sql("select account_id from DB1.`char` right join DB2.login on login.account_id = `char`.account_id where `char`.online = 1 and login.last_ip = '"+ getcharip() +"'",.@a ); But no success. Could anyone help me in these two situations? Thanks in advance!
-
Hello guys, need help with this script by Loki. It's working perfectly, except the verification part. It's logging two achievements for the same player, take a look: //===== Athena Script ===================================== //= Achievement System //===== By ================================================ //= Loki1991 //===== Version =========================================== //= 1.0 - First release //= 1.0.1 - Small hotfix for older rathena/eathena systems //===== Description ======================================= //= A full working Achivement System without any source edit! //= A well guide about this script can be found in rathena! //========================================================= - script achievementSystem -1,{ OnInit: //config start set $a_cache_expire,120; set $a_effect_id,908; set $a_cutin_delay,8000; //config end. Don't change anything below if you don't know what ya doing set $a_cached,0; end; //Cache achivements for .@cache_expire secounds OnPCLoginEvent: if(gettimetick(2)-$a_cached <= $a_cache_expire && $a_cached != 0) goto InventoryChecker; query_sql("SELECT * FROM achievement",.@id,.@name$,.@desc$,.@mode,.@deleted$,.@cutin$,.@points,.@single_val,.@val1,.@val1amount,.@val2,.@val2amount,.@val3,.@val3amount,.@val4,.@val4amount,.@val5,.@val5amount,.@val6,.@val6amount,.@val7,.@val7amount,.@val8,.@val8amount,.@val9,.@val9amount); set .@i,0; set $a_mode_other,0; set $a_mode_item,0; set $a_mode_mob,0; set $a_mode_mvp,0; set $a_mode_pvp,0; set $a_mode_lvl,0; set $a_mode_jlvl,0; while(.@i < getarraysize(.@id)) { setd("$a_name_"+.@id[.@i]+"$",.@name$[.@i]); setd("$a_desc_"+.@id[.@i]+"$",.@desc$[.@i]); setd("$a_mode_"+.@id[.@i],.@mode[.@i]); setd("$a_del_"+.@id[.@i]+"$",.@deleted$[.@i]); setd("$a_cutin_"+.@id[.@i]+"$",.@cutin$[.@i]); setd("$a_points_"+.@id[.@i],.@points[.@i]); setd("$a_val1_"+.@id[.@i],.@val1[.@i]); setd("$a_val1a_"+.@id[.@i],.@val1amount[.@i]); setd("$a_val2_"+.@id[.@i],.@val2[.@i]); setd("$a_val2a_"+.@id[.@i],.@val2amount[.@i]); setd("$a_val3_"+.@id[.@i],.@val3[.@i]); setd("$a_val3a_"+.@id[.@i],.@val3amount[.@i]); setd("$a_val4_"+.@id[.@i],.@val4[.@i]); setd("$a_val4a_"+.@id[.@i],.@val4amount[.@i]); setd("$a_val5_"+.@id[.@i],.@val5[.@i]); setd("$a_val5a_"+.@id[.@i],.@val5amount[.@i]); setd("$a_val6_"+.@id[.@i],.@val6[.@i]); setd("$a_val6a_"+.@id[.@i],.@val6amount[.@i]); setd("$a_val7_"+.@id[.@i],.@val7[.@i]); setd("$a_val7a_"+.@id[.@i],.@val7amount[.@i]); setd("$a_val8_"+.@id[.@i],.@val8[.@i]); setd("$a_val8a_"+.@id[.@i],.@val8amount[.@i]); setd("$a_val9_"+.@id[.@i],.@val9[.@i]); setd("$a_val9a_"+.@id[.@i],.@val9amount[.@i]); setd("$a_sval_"+.@id[.@i],.@single_val[.@i]); switch(.@mode[.@i]) { default: set $a_mode_other,$a_mode_other+1; break; case 1: set $a_mode_item,$a_mode_item+1; break; case 2: set $a_mode_mob,$a_mode_mob+1; break; case 3: set $a_mode_mvp,$a_mode_mvp+1; break; case 4: set $a_mode_pvp,$a_mode_pvp+1; break; case 5: set $a_mode_lvl,$a_mode_lvl+1; break; case 6: set $a_mode_jlvl,$a_mode_jlvl+1; break; } set .@i,.@i+1; } set $achive_amount, .@i; set $a_cached,gettimetick(2); end; //Monsterkills (mode mob,mvp) OnNPCKillEvent: //killedrid if($a_mode_mob>0 || $a_mode_mvp>0) { set .@i,0; while(.@i < $achive_amount) { set .@i,.@i+1; if((getd("$a_mode_"+.@i)!=2 && getd("$a_mode_"+.@i)!=3) || getd("a_done_"+.@i)==1 || getd("$a_del_"+.@i+"$")=="y") continue; if(getd("$a_mode_"+.@i)==2 && $a_mode_mob > 0 && achieve_mob < $a_mode_mob) { set .@valCount,0; set .@ok,0; while(.@valCount < 9) { set .@valCount,.@valCount+1; if(getd("$a_val"+.@valCount+"_"+.@i)==0 || getd("$a_val"+.@valCount+"a_"+.@i)==0) { set .@ok,.@ok+1; continue; } //Skip trash or empty if(killedrid == getd("$a_val"+.@valCount+"_"+.@i)) setd("a_state_"+.@i+"_"+.@valCount,getd("a_state_"+.@i+"_"+.@valCount) + 1); if(getd("a_state_"+.@i+"_"+.@valCount) == getd("$a_val"+.@valCount+"a_"+.@i)) set .@ok,.@ok+1; } if(.@ok == 9) callfunc "achieve",.@i; } else if(getd("$a_mode_"+.@i)==3 && $a_mode_mvp > 0 && achieve_mvp < $a_mode_mvp) { switch(killedrid) { default: break; case 1511: case 1647: case 1785: case 1630: case 1929: case 1039: case 1874: case 1272: case 1719: case 1046: case 1389: case 1112: case 1115: case 1957: case 1418: case 1871: case 1252: case 1768: case 1086: case 1649: case 1651: case 1832: case 1492: case 1734: case 1251: case 1779: case 1688: case 1646: case 1373: case 1147: case 1059: case 1150: case 1956: case 1087: case 1190: case 1038: case 1157: case 1159: case 1502: case 1623: case 1650: case 1583: case 1708: case 1312: case 1751: case 1685: case 1648: case 1917: case 1658: case 1885: case 2068: case 2238: case 2240: case 2236: case 2241: case 1980: case 2156: case 2022: case 2235: case 2237: case 2087: case 2165: case 2239: setd("a_state_"+.@i,getd("a_state_"+.@i) + 1); if(getd("a_state_"+.@i) >= getd("$a_sval_"+.@i)) callfunc "achieve",.@i; break; } } } } goto InventoryChecker; end; //PvP (mode pvp) OnPCKillEvent: if($a_mode_pvp==0 || achieve_pvp==$a_mode_pvp) end; set pvp_counter,pvp_counter+1; set .@i,0; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_mode_"+.@i)!=4 || getd("a_done_"+.@i)==1 || getd("$a_del_"+.@i+"$")=="y") continue; if(pvp_counter >= getd("$a_sval_"+.@i)) callfunc "achieve",.@i; } end; //LevelUP (mode lvl) OnPCBaseLvUpEvent: if($a_mode_lvl==0 || achieve_lvl==$a_mode_lvl) end; set .@i,0; while(.@i < $achive_amount) { setd("a_done_"+.@i,0); set .@i,.@i+1; if(getd("$a_mode_"+.@i) !=5 || getd("a_done_"+.@i)==1 || getd("$a_del_"+.@i+"$")=="y") continue; dispbottom "" + getd("$a_sval_"+.@i); if(BaseLevel >= getd("$a_sval_"+.@i)) callfunc "achieve",.@i; } end; //JobLevelUP (mode jlvl) OnPCJobLvUpEvent: if($a_mode_jlvl==0 || achieve_jlvl==$a_mode_jlvl) end; set .@i,0; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_mode_"+.@i)!=6 || getd("a_done_"+.@i)==1 || getd("$a_del_"+.@i+"$")=="y") continue; if(JobLevel >= getd("$a_sval_"+.@i)) callfunc "achieve",.@i; } end; //Get X Amount of Items in your inventar (mode item) //will be called after mob kill or map change InventoryChecker: if($a_mode_item==0 || achieve_item==$a_mode_item) end; set .@i,0; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_mode_"+.@i) !=1 || getd("a_done_"+.@i)==1 || getd("$a_del_"+.@i+"$")=="y") continue; set .@valCount,0; set .@ok,0; while(.@valCount < 9) { set .@valCount,.@valCount+1; if(getd("$a_val"+.@valCount+"_"+.@i)==0 || getd("$a_val"+.@valCount+"a_"+.@i)==0) { set .@ok,.@ok+1; continue; } //Skip trash or empty if(countitem(getd("$a_val"+.@valCount+"_"+.@i)) >= getd("$a_val"+.@valCount+"a_"+.@i)) set .@ok,.@ok+1; } if(.@ok == 9) callfunc "achieve",.@i; } end; //special (mode special) //No script. Just place 'callfunc "achieve",<<yourAchievementId>>;' anywhere in your script (below). } function script achieve { set .@achieveId,getarg(0); if(.@achieveId <= 0) end; //Param missing. WTF query_sql("SELECT id FROM achievement_log WHERE ach_id='"+.@achieveId+"' AND char_id='"+.@achieveId+"'",.@id); if(.@id>0) { setd("a_done_"+.@achieveId,1); end; } //User already got this achievement... Strange //Everything looks fine, lets do it query_sql("INSERT INTO achievement_log(ach_id,char_id,crdate) VALUES('"+.@achieveId+"','"+getcharid(0)+"','"+gettimetick(2)+"')"); switch(getd("$a_mode_"+.@achieveId)) { default: set achieve_other,achieve_other+1; break; case 1: set achieve_item,achieve_item+1; break; case 2: set achieve_mob,achieve_mob+1; break; case 3: set achieve_mvp,achieve_mvp+1; break; case 4: set achieve_pvp,achieve_pvp+1; break; case 5: set achieve_lvl,achieve_lvl+1; break; case 6: set achieve_jlvl,achieve_jlvl+1; break; } if($a_effect_id>0) { specialeffect2 $a_effect_id; } announce strcharinfo(0)+" conseguiu a Conquista ["+getd("$a_name_"+.@achieveId+"$")+"]!",0; setd("a_done_"+.@achieveId,1); query_sql("UPDATE `char` SET achievement_points=achievement_points+"+getd("$a_points_"+.@achieveId)+" WHERE char_id="+getcharid(0)); if(getd("$a_cutin_"+.@achieveId+"$") != "") { cutin getd("$a_cutin_"+.@achieveId+"$"),4; sleep2 $a_cutin_delay; cutin "",255; } end; } function script getMonsterNameById { if(getarg(0)<=0) end; query_sql("SELECT iName FROM mob_db WHERE ID="+getarg(0)+" UNION SELECT iName FROM mob_db2 WHERE ID="+getarg(0),.@mobName$); return .@mobName$; } vilasyn,130,71,4 script Quadro de Conquistas 4_BOARD3,{ //Bob Config Params set .@name$,"[^FF0000Quadro de Conquistas^000000]"; //set .@cutin$,"sc_vicente01"; set .@GmMenuAtWhichLevel,99; set .@text_gmMenu$,"Olá GM. Que tipo de menu você quer visualizar?"; set .@text_startInfo$,"Eu tenho todas as informações sobre as Conquistas que estão ativadas nesse servidor."; set .@text_category$,"Por favor, selecione a categoria."; set .@text_whichAch$,"Para qual conquista você quer obter detalhes?"; set .@text_points$,"Você têm essa quantidade de Pontos de Conquista:"; set .@text_close$,"Não estou interessado(a)."; set .@text_worth$,"Vale:"; set .@text_getPoints$,"pontos"; set .@text_bye$,"Tenha um ótimo dia!"; set .@text_kill$,"Cace"; set .@text_mvp$,"qualquer tipo de MvP"; set .@text_pvp$,"qualquer jogador"; set .@text_lvl$,"Alcance o nível de base"; set .@text_jlvl$,"Alcance o nível de classe"; set .@text_mode_item$,"Conquistas de Itens"; set .@text_mode_mob$,"Conquistas de Monstros"; set .@text_mode_mvp$,"Conquistas de MvP"; set .@text_mode_pvp$,"Conquistas de PvP"; set .@text_mode_lvl$,"Conquistas de Nível de Base"; set .@text_mode_jlvl$,"Conquistas de Nível de Classe"; set .@text_mode_other$,"Outras Conquistas"; query_sql("SELECT achievement_points FROM `char` WHERE char_id="+getcharid(0),.@points); //Check if a gm has set the player to a force action query_sql("SELECT ach_id, mode FROM achievement_force WHERE done='n' AND char_id="+getcharid(0),.@ach_id,.@mode$); if(getarraysize(.@ach_id) > 0) { set .@i,0; while(.@i < getarraysize(.@ach_id)) { //Clear log before there is to much trash inside query_sql("SELECT id FROM achievement_log WHERE ach_id="+.@ach_id[.@i]+" AND char_id="+getcharid(0),.@log_id); query_sql("UPDATE achievement_force SET done='y' WHERE done='n' AND ach_id="+.@ach_id[.@i]+" AND char_id="+getcharid(0)); if(.@log_id > 0) query_sql("DELETE FROM achievement_log WHERE id="+.@log_id); if(.@mode$=="add") { if(getd("a_done_"+.@ach_id[.@i]) == 1) { query_sql("UPDATE `char` SET achievement_points=achievement_points-"+getd("$a_points_"+.@ach_id[.@i])+" WHERE char_id="+getcharid(0)); } setd("a_done_"+.@ach_id[.@i],0); callfunc "achieve",.@ach_id[.@i]; } else { query_sql("SELECT mode FROM achievement WHERE id="+.@ach_id[.@i],.@mode); if(.@mode == 2) { set .@j,0; while(.@j < 9) { set .@j,.@j+1; setd("a_state_"+.@ach_id[.@i]+"_"+.@j,0); } } else if(.@mode == 3) { setd("a_state_"+.@ach_id[.@i],0); } if(getd("a_done_"+.@ach_id[.@i]) == 1) { query_sql("UPDATE `char` SET achievement_points=achievement_points-"+getd("$a_points_"+.@ach_id[.@i])+" WHERE char_id="+getcharid(0)); } setd("a_done_"+.@ach_id[.@i],0); dispbottom "A Conquista "+getd("$a_name_"+.@ach_id[.@i]+"$")+" foi removida!"; } set .@i,.@i+1; } } //Start the true script //cutin .@cutin$,2; //If a gm talks to this npc, call the gm menu, else the normal script if(getgmlevel() >= .@GmMenuAtWhichLevel) { mes .@name$; mes .@text_gmMenu$; next; menu "Menu do GM",L_GM,"Menu do Jogador",-,.@text_close$,L_End; } mes .@name$; mes .@text_startInfo$; next; mes .@name$; mes .@text_points$+" ^00AA00"+.@points+"^000000"; mes .@text_category$; next; set .@i,0; if($a_mode_other > 0) { set .@menu$,.@menu$+.@text_mode_other$+":"; setarray .@tempAr1[.@i],0; set .@i,.@i+1; } if($a_mode_item > 0) { set .@menu$,.@menu$+.@text_mode_item$+":"; setarray .@tempAr1[.@i],1; set .@i,.@i+1; } if($a_mode_mob > 0) { set .@menu$,.@menu$+.@text_mode_mob$+":"; setarray .@tempAr1[.@i],2; set .@i,.@i+1; } if($a_mode_mvp > 0) { set .@menu$,.@menu$+.@text_mode_mvp$+":"; setarray .@tempAr1[.@i],3; set .@i,.@i+1; } if($a_mode_pvp > 0) { set .@menu$,.@menu$+.@text_mode_pvp$+":"; setarray .@tempAr1[.@i],4; set .@i,.@i+1; } if($a_mode_lvl > 0) { set .@menu$,.@menu$+.@text_mode_lvl$+":"; setarray .@tempAr1[.@i],5; set .@i,.@i+1; } if($a_mode_jlvl > 0) { set .@menu$,.@menu$+.@text_mode_jlvl$+":"; setarray .@tempAr1[.@i],6; set .@i,.@i+1; } if(.@i == 0) { mes .@name$; mes "Ops! Não encontrei nenhuma Conquista =/"; //cutin "",255; close; } set .@menu$,.@menu$+.@text_close$; set .@choose,select(.@menu$); set .@choose,.@choose-1; if( .@choose == .@i) goto L_End; next; mes .@name$; mes .@text_whichAch$; set .@i,0; set .@j,0; set .@menu$,""; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_mode_"+.@i) != .@tempAr1[.@choose] || getd("$a_del_"+.@i+"$")=="y") continue; if(getd("a_done_"+.@i) == 1) { set .@menu$,.@menu$+"^00AA00"; } else { set .@menu$,.@menu$+"^FF0000"; } set .@menu$,.@menu$+getd("$a_name_"+.@i+"$")+" ["+getd("$a_points_"+.@i)+"]^000000"+":"; setarray .@tempAr2[.@j],.@i; set .@j,.@j+1; } set .@menu$,.@menu$+.@text_close$; set .@choose2,select(.@menu$); set .@choose2,.@choose2-1; if( .@choose2 == .@j) { next; goto L_End; } next; mes .@name$; if(getd("$a_desc_"+.@tempAr2[.@choose2]+"$") != "") { mes getd("$a_desc_"+.@tempAr2[.@choose2]+"$"); next; mes .@name$; } mes "^0000AA"+.@text_worth$+" "+getd("$a_points_"+.@tempAr2[.@choose2])+" "+.@text_getPoints$+"^000000"; if(.@tempAr1[.@choose] > 0) { if(.@tempAr1[.@choose] == 1 || .@tempAr1[.@choose] == 2) { set .@i,0; while(.@i < 9) { set .@i,.@i+1; if(getd("$a_val"+.@i+"_"+.@tempAr2[.@choose2])>0 && getd("$a_val"+.@i+"a_"+.@tempAr2[.@choose2])>0) { if(.@tempAr1[.@choose] == 1) { mes "^0000AA"+getitemname(getd("$a_val"+.@i+"_"+.@tempAr2[.@choose2]))+" ["+countitem(getd("$a_val"+.@i+"_"+.@tempAr2[.@choose2]))+"/"+getd("$a_val"+.@i+"a_"+.@tempAr2[.@choose2])+"]^000000"; } else { mes "^0000AA"+.@text_kill$+" "+callfunc("getMonsterNameById",getd("$a_val"+.@i+"_"+.@tempAr2[.@choose2]))+" ["+getd("a_state_"+.@tempAr2[.@choose2]+"_"+.@i)+"/"+getd("$a_val"+.@i+"a_"+.@tempAr2[.@choose2])+"]^000000"; } } } } else { if(.@tempAr1[.@choose] == 3) mes "^0000AA"+.@text_kill$+" "+getd("$a_sval_"+.@tempAr2[.@choose2])+" "+.@text_mvp$+" ["+getd("a_state_"+.@tempAr2[.@choose2])+"/"+getd("$a_sval_"+.@tempAr2[.@choose2])+"]^000000"; if(.@tempAr1[.@choose] == 4) mes "^0000AA"+.@text_kill$+" "+getd("$a_sval_"+.@tempAr2[.@choose2])+" "+.@text_pvp$+" ["+pvp_counter+"/"+getd("$a_sval_"+.@tempAr2[.@choose2])+"]^000000"; if(.@tempAr1[.@choose] == 5) mes "^0000AA"+.@text_lvl$+" "+getd("$a_sval_"+.@tempAr2[.@choose2])+" ["+BaseLevel+"/"+getd("$a_sval_"+.@tempAr2[.@choose2])+"]^000000"; if(.@tempAr1[.@choose] == 6) mes "^0000AA"+.@text_jlvl$+" "+getd("$a_sval_"+.@tempAr2[.@choose2])+" ["+JobLevel+"/"+getd("$a_sval_"+.@tempAr2[.@choose2])+"]^000000"; } } next; goto L_End; L_GM: mes .@name$; mes .@text_category$; next; switch(select("Forçar Conquista ao Jogador","Habilitar/Desabilitar Conquistas","Limpar o cache","Comparar o Log com os Pontos de Conquista",.@text_close$)) { case 1: mes .@name$; mes "Se o jogador que você indiciar aqui falar comigo, você pode setar algumas ações que acontecerão, por exemplo, dar uma conquista, ou retirá-la."; mes "Qual o nome do jogador?"; next; input .@char_name$; next; mes .@name$; query_sql("SELECT char_id FROM `char` WHERE name='"+.@char_name$+"'",.@char_id); if(.@char_id > 0) { mes "Qual conquista?"; next; set .@i,0; set .@j,0; set .@menu$,""; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_del_"+.@i+"$") == "y") continue; set .@menu$,.@menu$+getd("$a_name_"+.@i+"$")+":"; set .@j,.@j+1; setarray .@tempAr1[.@j],.@i; } set .@menu$,.@menu$+.@text_close$; set .@choose,select(.@menu$); if( .@choose == .@j+1) goto L_GM; next; mes .@name$; mes "Adicionando ou removendo essa conquista?"; next; switch(select("Adicionar","Remover",.@text_close$)) { case 1: set .@mode$,"add"; break; case 2: set .@mode$,"del"; break; case 3: goto L_GM; break; } next; mes .@name$; mes "Jogador: "+.@char_name$; mes "Conquista: "+getd("$a_name_"+.@tempAr1[.@choose]+"$")+" (id="+.@tempAr1[.@choose]+")"; mes "Modo: "+.@mode$; mes "Tem certeza?"; next; menu "Sim!",-,"Não",L_GM; mes .@name$; query_sql("INSERT INTO achievement_force(ach_id,char_id,mode) VALUES('"+.@tempAr1[.@choose]+"','"+.@char_id+"','"+.@mode$+"')"); if(.@mode$=="del") { switch(getd("$a_mode_"+.@tempAr1[.@choose])) { default: set achieve_other,achieve_other-1; break; case 1: set achieve_item,achieve_item-1; break; case 2: set achieve_mob,achieve_mob-1; break; case 3: set achieve_mvp,achieve_mvp-1; break; case 4: set achieve_pvp,achieve_pvp-1; break; case 5: set achieve_lvl,achieve_lvl-1; break; case 6: set achieve_jlvl,achieve_jlvl-1; break; } } mes "Ação inserida! "+.@char_name$+" deve falar comigo agora!"; next; } else { mes "Jogador não encontrado!"; next; } goto L_GM; break; case 2: mes .@name$; mes "Vermelho = desabilitada | Verde = habilitada."; mes "Be carefull on your achivements you added without triggers (mode 0). If you don't check there if the achivement is deleted, it may cause problems"; set .@i,0; set .@menu$,""; while(.@i < $achive_amount) { set .@i,.@i+1; if(getd("$a_del_"+.@i+"$") == "n") { set .@menu$,.@menu$+"^00AA00"; } else { set .@menu$,.@menu$+"^FF0000"; } set .@menu$,.@menu$+getd("$a_name_"+.@i+"$")+"^000000:"; } set .@menu$,.@menu$+.@text_close$; next; set .@choose,select(.@menu$); if(.@choose <= .@i) { if(getd("$a_del_"+.@choose+"$") == "n") { set .@updateTo$,"y"; } else { set .@updateTo$,"n"; } query_sql("UPDATE achievement SET deleted='"+.@updateTo$+"' WHERE id="+.@choose); dispbottom "Achivement "+getd("$a_name_"+.@choose+"$")+" updated to deleted='"+.@updateTo$+"'!"; dispbottom "Clear Cache to see any effects!!!"; goto L_GM; } break; case 3: set $a_cached,0; dispbottom "Cache remove Flag has been set. When the next player login, the cache will be cleared"; goto L_GM; break; case 4: //if you build in something like "For 100 achivement points get 1 Cookie", this function would be buggy! query_sql("SELECT char_id,achievement_points,name FROM `char`",.@char_id,.@ach_points,.@char_name$); set .@i,0; dispbottom "Sync started!"; while(.@i < getarraysize(.@char_id)) { cleararray .@ach_id[0],0,getarraysize(.@ach_id); query_sql("SELECT ach_id FROM achievement_log WHERE char_id="+.@char_id[.@i],.@ach_id); set .@j,0; set .@points,0; while(.@j < getarraysize(.@ach_id)) { set .@points,.@points+getd("$a_points_"+.@ach_id[.@j]); set .@j,.@j+1; } if(.@ach_points[.@i] != .@points) { query_sql("UPDATE `char` SET achievement_points="+.@points+" WHERE char_id="+.@char_id[.@i]); dispbottom .@char_name$[.@i]+" had "+.@ach_points[.@i]+" points, but should have "+.@points+" points. Fixed!"; } set .@i,.@i+1; } dispbottom "Sync done!"; goto L_GM; break; case 5: break; } goto L_End; L_End: mes .@name$; mes .@text_bye$; close2; //cutin "",255; end; } I believe there's something wrong in this part: query_sql("SELECT id FROM achievement_log WHERE ach_id='"+.@achieveId+"' AND char_id='"+.@achieveId+"'",.@id); if(.@id>0) { setd("a_done_"+.@achieveId,1); end; } //User already got this achievement... Strange Could anyone help me? Thanks!
-
Hello guys, I'm having problem setting up FluxCP for multi servers. I have 3 servers, each one of them use a different database. The only thing in common is that they use the same login database (which is one of the 3 servers). So I need FluxCP to register only in one DB. How can I add them to FluxCP? Thanks!
-
RO Credentials (ROCred), v1.10.0 - last updated 2017/12/31
Guih replied to Ai4rei's topic in Client Releases
@Ai4rei Thanks for the amazing tool! Is there anyway to make different buttons for different clients? For example, I have 3 different clients, I'd like to make 3 start buttons, one for each client on the same tool, is that possible? -
Hello everyone! How can I disable the channel system while woe is happening? Something with OnAgitStart maybe? And then at the end enable it back. Is that possible? Thanks!
-
Thank you Emistry, it worked perfectly!
-
will work without problem I tried it, but it didn't work =/ It seems that the duplicates also get the variable of the main NPC, so I can't get the apples in the duplicates
-
Okay, that worked, thanks Skorm! But I need to duplicate it to a lot of maps, and with this script of yours I can't use the NPC on the other map if I've used it already... How can I make it usable per map? Thanks ;D
-
Hello everyone, I'd like to have an NPC where I could collect about 20 Apples per day and only one time independent of the person who collected. Is that possible? Thanks in advance!
-
just add timer in script Onclock or Onminute Sorry, i'm not good with script... How's that supposed to make it spawn in all maps loaded in the server?
-
Hey guys, about this script, is there anyway I can make it spawn in all maps automatically? Instead of putting all maps manually in the array... Thanks
-
Hello everyone! I'm having a problem with the Item Shop in FluxCP. When I go to the Purchase section of it, the items don't show up. It gives me this message: There are currently no items for sale. When I activate the debug and error modes, the following error is shown up: Here are the files: modules/purchase/index.php: <?php if (!defined('FLUX_ROOT')) exit; $title = 'Loja de Itens'; require_once 'Flux/ItemShop.php'; $category = $params->get('category'); $categories = Flux::config("ShopCategories")->toArray(); $categoryName = Flux::config("ShopCategories.$category"); $categoryCount = array(); $shop = new Flux_ItemShop($server); $sql = sprintf("SELECT COUNT(id) AS total FROM %s.%s WHERE category = ?", $server->charMapDatabase, Flux::config('FluxTables.ItemShopTable')); $sql2 = sprintf("SELECT COUNT(id) AS total FROM %s.%s", $server->charMapDatabase, Flux::config('FluxTables.ItemShopTable')); $sth = $server->connection->getStatement($sql); $sth2 = $server->connection->getStatement($sql2); $sth2->execute(); $total = $sth2->fetch()->total; foreach ($categories as $catID => $catName) { $sth->execute(array($catID)); $categoryCount[$catID] = $sth->fetch()->total; } $categoryTotal = isset($category) ? $categoryCount[$category] : $total; $perPage = Flux::config("ItemShopItemPerPage"); $paginator = $this->getPaginator($categoryTotal, array('perPage' => $perPage)); $items = $shop->getItems($paginator, $category); ?> lib/Flux/ItemShop.php <?php require_once 'Flux/TemporaryTable.php'; require_once 'Flux/ItemExistsError.php'; class Flux_ItemShop { /** * @access public * @var Flux_Athena */ public $server; public function __construct(Flux_Athena $server) { $this->server = $server; } /** * Add an item to the shop. */ public function add($itemID, $categoryID, $cost, $quantity, $info, $useExisting = 0) { $db = $this->server->charMapDatabase; $table = Flux::config('FluxTables.ItemShopTable'); $sql = "INSERT INTO $db.$table (nameid, category, quantity, cost, info, use_existing, create_date) VALUES (?, ?, ?, ?, ?, ?, NOW())"; $sth = $this->server->connection->getStatement($sql); $res = $sth->execute(array($itemID, $categoryID, $quantity, $cost, $info, $useExisting)); $sth2 = $this->server->connection->getStatement('SELECT LAST_INSERT_ID() AS insID'); $res2 = $sth2->execute(); if ($res && $res2 && ($insertID=$sth2->fetch()->insID)) { return $insertID; } else { return false; } } /** * Modify item info in the shop. */ public function edit($shopItemID, $categoryID = null, $cost = null, $quantity = null, $info = null, $useExisting = null) { $catQ = ''; $crdQ = ''; $qtyQ = ''; $infQ = ''; $imgQ = ''; $bind = array(); if (!is_null($categoryID)) { $catQ = "category = ? "; $bind[] = (int)$categoryID; } if (!is_null($cost)) { if ($catQ) { $crdQ = ", cost = ? "; } else { $crdQ = "cost = ? "; } $bind[] = (int)$cost; } if (!is_null($quantity)) { if ($crdQ) { $qtyQ = ', quantity = ? '; } else { $qtyQ = "quantity = ? "; } $bind[] = (int)$quantity; } if (!is_null($info)) { if ($qtyQ) { $infQ = ', info = ? '; } else { $infQ = "info = ? "; } $bind[] = trim($info); } if (!is_null($useExisting)) { if ($infQ) { $imgQ = ', use_existing = ? '; } else { $imgQ = "use_existing = ? "; } $bind[] = (int)$useExisting; } if (empty($bind)) { return false; } $db = $this->server->charMapDatabase; $table = Flux::config('FluxTables.ItemShopTable'); $sql = "UPDATE $db.$table SET $catQ $crdQ $qtyQ $infQ $imgQ WHERE id = ?"; $sth = $this->server->connection->getStatement($sql); $bind[] = $shopItemID; return $sth->execute($bind); } /** * */ public function delete($shopItemID) { $db = $this->server->charMapDatabase; $table = Flux::config('FluxTables.ItemShopTable'); $sql = "DELETE FROM $db.$table WHERE id = ?"; $sth = $this->server->connection->getStatement($sql); return $sth->execute(array($shopItemID)); } /** * */ public function buy(Flux_DataObject $account, $shopItemID) { } /** * */ public function getItem($shopItemID) { $db = $this->server->charMapDatabase; if($this->server->isRenewal) { $fromTables = array("$db.item_db_re", "$db.item_db2"); } else { $fromTables = array("$db.item_db", "$db.item_db2"); } $temp = new Flux_TemporaryTable($this->server->connection, "$db.items", $fromTables); $shop = Flux::config('FluxTables.ItemShopTable'); $col = "$shop.id AS shop_item_id, $shop.category AS shop_item_category, $shop.cost AS shop_item_cost, $shop.quantity AS shop_item_qty, $shop.use_existing AS shop_item_use_existing, "; $col .= "$shop.nameid AS shop_item_nameid, $shop.info AS shop_item_info, items.name_japanese AS shop_item_name"; $sql = "SELECT $col FROM $db.$shop LEFT OUTER JOIN $db.items ON items.id = $shop.nameid WHERE $shop.id = ?"; $sth = $this->server->connection->getStatement($sql); if ($sth->execute(array($shopItemID))) { return $sth->fetch(); } else { return false; } } /** * */ public function getItems($paginator, $categoryID = null) { $sqlpartial = ""; $bind = array(); $db = $this->server->charMapDatabase; if($this->server->isRenewal) { $fromTables = array("$db.item_db_re", "$db.item_db2"); } else { $fromTables = array("$db.item_db", "$db.item_db2"); } $temp = new Flux_TemporaryTable($this->server->connection, "$db.items", $fromTables); $shop = Flux::config('FluxTables.ItemShopTable'); $col = "$shop.id AS shop_item_id, $shop.cost AS shop_item_cost, $shop.quantity AS shop_item_qty, $shop.use_existing AS shop_item_use_existing, "; $col .= "$shop.nameid AS shop_item_nameid, $shop.info AS shop_item_info, items.name_japanese AS shop_item_name"; if (!is_null($categoryID)) { $sqlpartial = " WHERE $shop.category = ?"; $bind[] = $categoryID; } $sql = $paginator->getSQL("SELECT $col FROM $db.$shop LEFT OUTER JOIN $db.items ON items.id = $shop.nameid $sqlpartial"); $sth = $this->server->connection->getStatement($sql); if ($sth->execute($bind)) { return $sth->fetchAll(); } else { return false; } } /** * */ public function deleteShopItemImage($shopItemID) { $serverName = $this->server->loginAthenaGroup->serverName; $athenaServerName = $this->server->serverName; $dir = FLUX_DATA_DIR."/itemshop/$serverName/$athenaServerName"; $files = glob("$dir/$shopItemID.*"); foreach ($files as $file) { unlink($file); } return true; } /** * */ public function uploadShopItemImage($shopItemID, Flux_Config $file) { if ($file->get('error')) { return false; } $validexts = array_map('strtolower', Flux::config('ShopImageExtensions')->toArray()); $extension = strtolower(pathinfo($file->get('name'), PATHINFO_EXTENSION)); if (!in_array($extension, $validexts)) { return false; } $serverName = $this->server->loginAthenaGroup->serverName; $athenaServerName = $this->server->serverName; $dir = FLUX_DATA_DIR."/itemshop/$serverName/$athenaServerName"; if (!is_dir(FLUX_DATA_DIR."/itemshop/$serverName")) { mkdir(FLUX_DATA_DIR."/itemshop/$serverName"); } if (!is_dir($dir)) { mkdir($dir); } $this->deleteShopItemImage($shopItemID); if (move_uploaded_file($file->get('tmp_name'), "$dir/$shopItemID.$extension")) { return true; } else { return false; } } } ?> Could anyone help me fixing it? Thanks in advance