Jump to content

Skorm

Forum Moderator
  • Posts

    1,238
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by Skorm

  1. At some point query_sql was changed to return -1 instead of zero when failing. if(!query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS)) Should be if(query_sql("SELECT `points` FROM `wicked_ladder` WHERE `char_id` = "+getcharid(0)+"",@WA_POINTS) <= 0) I can't say that will fix your problem for sure though. Make sure your database is correct.
  2. @hikashin-rae You're lucky I was randomly browsing google to see if people were able to find the woe timer I made for Euphy's WOE Setter and found your post. http://upaste.me/a34345394862f242d
  3. Wrong section. Moved to "Source Support".
  4. Wrong section. Moved to "Scripting Support".
  5. This isn't a full representation of what you want, but it's a start. I can't even remember if OnTouch works with moving NPCs. function script fWalkable { [email protected]$ = getarg(0); freeloop(1); do { [email protected] = rand(getarg(1)); [email protected] = rand(getarg(2,getarg(1))); } while (checkcell([email protected]$,[email protected],[email protected],cell_chkwall) || checkcell([email protected]$,[email protected],[email protected],cell_chkcliff) || checkcell([email protected]$,[email protected],[email protected],cell_chknopass) || checkcell([email protected]$,[email protected],[email protected],cell_chknoreach)); return ([email protected]<<12)[email protected]; } - script Kaboom 111,{ end; OnTouch: if( rand(100) < 50 ) atcommand "@nuke " + strcharinfo(0); else getitem 501,1; disablenpc strnpcinfo(0); movenpc strnpcinfo(0), 0, 0; end; S_MoveNPC: explode([email protected]_ary$,strnpcinfo(2),"|"); [email protected]_xy = fWalkable(strnpcinfo(4), atoi([email protected]_ary$[0]), atoi([email protected]_ary$[1])); [email protected] = [email protected]_xy & 4095; [email protected] = [email protected]_xy >> 12; movenpc strnpcinfo(0), [email protected], [email protected]; enablenpc strnpcinfo(0); sleep 60000; callsub S_MoveNPC; OnInit: disablenpc strnpcinfo(0); if( strnpcinfo(2) != "" ) callsub S_MoveNPC; } prontera,0,0,0 duplicate(Kaboom) Kaboom 1#300|300 111,4,4
  6. How did you just now get source level 1. lel

    1. Lemongrass

      Lemongrass

      Haha guess because of the rules.
      If I'm not mistaken this was bound to the number of releases you've made.
      Outside of github/SVN I have not offered any (public) releases. ;)
      But I need to go through all 3 levels like everyone else, but you are free to nominate me for the next level. :)

  7. It took me a bit to understand dynamic shops when I was first learning too. This is the npc I used to understand dynamic shops but I added a bunch of comments hopefully it helps. ( Disclaimer: This npc is old and doesn't have all the necessary weight checks and mumbo-jumbo I'm providing it as an example because it's simple. ) - shop custom_seller2 -1,501:20 // Create our dummy shop. prontera.gat,95,99,5 script WoE Shop 100,{ // This code runs when the user clicks our npc. mes "I will sell you items for " + getitemname(.CoinID) + "."; // Let the user know about our shop. callshop "custom_seller2",1; // Summon our dummy shop filled with custom items. npcshopattach "custom_seller2"; // Attach the shop to this npc. end; // This code runs when a user purchases an item from our shop. OnBuyItem: [email protected] = getarraysize(.customs); // Get the number of customs we've added. [email protected]_len = getarraysize(@bought_nameid); // Get the number of purchased items. for( set @i, 0; @i < [email protected]; set @i, @i+1 ) { // Loop through all our custom items. for( set @d,0; @d < [email protected]_len; set @d, @d+1 ) { // Loop through all the purchased items. if( @bought_nameid[@d] == .customs[@i] ) { // Check if the purchased item equals our custom item. if( countitem(.CoinID) >= .Price[@i] * @bought_quantity[@d] ) { // Check if the user has the correct funds. delitem .CoinID,.Price[@i]*@bought_quantity[@d]; getitem @bought_nameid[@d],@bought_quantity[@d]; } } } } deletearray @bought_quantity, getarraysize(@bought_quantity); // Remove the array. deletearray @bought_nameid, getarraysize(@bought_nameid); // Remove the array. close; // This code runs first. When the server is started. OnInit: setarray .customs[0],12103,607,678; // An array of our custom items. set .CoinID,7227; // Currency used for the transaction. setarray .Price[0],20,40,300; // The amount of coins needed for our items. (For example: Item 12103 = 20 coins) npcshopitem "custom_seller2",0,0; // Remove all items from our dummy shop. for( set [email protected], 0; .customs[[email protected]]; set [email protected], [email protected]+1 ) // Loop through our custom items. npcshopadditem "custom_seller2",.customs[[email protected]],.Price[[email protected]]; // Add our custom items to the cleared dummy shop. end; }
  8. I agree with @Cydh only use OnNPCKillEvent: when you absolutely have to. Since it's going to trigger every time a mob gets killed in your server ever...
  9. query_sql("INSERT INTO `event_rewards` ( `account_id`, `event_name`, `id`, `amount`, `value` ) VALUES ( "[email protected]_id[.i]+", '"[email protected]$+"', "[email protected][.j]+", "[email protected][.k]+", 0) ");
  10. You only need escape_sql when dealing with string variables. [email protected] is a integer variable so nobody can put an escape character like "; or something to cause harm to your database. if the variable was [email protected]$ and a user put text for that [email protected]$ variable like '; DROP TABLE `accounts`; MySQL would read select `field` from `table` where `field` = ''; DROP TABLE `accounts`;
  11. '"[email protected]$+"' It's not double quotes like you have. It's quotes ( " ) then single quotes ( ' ). The single quotes are for SQL to be like OK this is a string. Normal Quotes are there to break the string server side. So what it's doing "String '(Start SQL String) (Break NPC Compiler String)"+([email protected]_string_variable$)+"(Enter NPC String) (End SQL String)' (End NPC String)"
  12. Find line 1179 in pet.c should look something like this. } else { // Item Targeted, attempt loot if (!check_distance_bl(&pd->bl, target, 1)) { // Out of range if(!unit_walktobl(&pd->bl, target, 1, 1)) // Unreachable target. pet_unlocktarget(pd); return 0; } else { struct flooritem_data *fitem = (struct flooritem_data *)target; Comment out this part. if(pd->loot->count < pd->loot->max) { memcpy(&pd->loot->item[pd->loot->count++],&fitem->item,sizeof(pd->loot->item[0])); pd->loot->weight += itemdb_weight(fitem->item.nameid)*fitem->item.amount; map_clearflooritem(target); } add below. if (!pc_additem(sd, &fitem->item, fitem->item.amount, LOG_TYPE_PICKDROP_PLAYER)) { map_clearflooritem(target); }
  13. atoi stands for ASCII to Integer. String -> Number getitemname uses an integer value you don't need to use atoi.
  14. I just tested the exact script you posted it works fine on my server np.
  15. I really don't think you have to worry about your database collapsing but if you're really concerned. Store all the kills in a character defined variable and then push them to the database when they logout. OnPCLogoutEvent: if( @kills || @deaths ) query_sql("UPDATE `pvp_table` SET kills += "[email protected]+", deaths += "[email protected]+" WHERE charid == "+getcharid(0)+";"); This is just to give you an idea you'll still have to check to see that a table has been created for that user before you can update it. There are plenty of other ways you could do something like this, but honestly you probably don't even have to worry about it unless you have an inane amount of players.
  16. If the users can instantiate SQL queries on a whim they could flood your SQL server with many requests. If controlled SQL makes it very easy todo things that would normally be time consuming in scripts with variables. For example: SELECT * FROM item_db_re ORDER BY price_buy DESC LIMIT 5; With one line I can easily find what are the most expensive items to purchase in the game. You could easily apply something like this to a pvp ranker. If you plan on keeping all your data for the players in variables they get hard to manage and remove, and the sql table for perm variables gets pinged by the server quite often so it's best to keep that as small as you can. This is where I would recommend using an SQL database. Without getting into it any further what I'm trying to say is. If used correctly SQL can be a powerful tool that should be taken advantage of, and for bigger scripts with lots of numbers and information there's no reason not to use SQL.
  17. Post the code you're testing in full.
  18. They forgot to use escape_sql() command when allowing the user to type things in when querying the sql server... So someone could end the statement early by adding ; then type their own stuff. Like ; DROP TABLE `accounts`; Or something much worse hahaha
  19. It should be in the unequip database section. When the RENTAL ITEM RUNS-OUT it activates the unequip-script this is something I tested and it was working at that time. If something changed with the source between when I tested it there isn't anything I can do about that. I recommend testing it further and submitting a bug report.
  20. When you mark things @solved and erase the initial question. If other people have a similar problem they can't find an answer, and it makes this entire topic useless. You can mark the topic solved by selecting a best answer... We're not here to host more useless threads.
  21. quiz_00,17,124,4 script Katonai 821,{ mes .npc$; mes "Hello there!"; mes "I can enchant your items,"; mes "for a small fee of "+.pric+"z."; emotion e_no1,0; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } if(Zeny<.pric) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; } mes .npc$; mes "Which item would you like to enchant?"; next; for( [email protected] = 0; [email protected] < .e_len; [email protected]++ ) { if(getequipid(.equiploc[[email protected]])>-1) { set [email protected]$, [email protected]$+.eqp$[[email protected]]+"- [^0000FF"+getitemname(getequipid(.equiploc[[email protected]]))+"^000000]:"; } else { set [email protected]$, [email protected]$+"^adb4be"+.eqp$[[email protected]]+"- [Empty]^000000:"; } } select([email protected]$); set [email protected]_loc, .equiploc[@menu-1]; set [email protected]_itm, getequipid([email protected]_loc); if([email protected]_itm<0) { mes .npc$; mes "Hmm, I don't think you have anything equipped there."; close; } set [email protected]$, ""; set([email protected],(getiteminfo([email protected]_itm,2)==4?4:[email protected]_loc)); for(set([email protected],0);[email protected]<getarraysize(getd(".itm"[email protected]));set([email protected],[email protected]+1)) { set([email protected],getd(".itm"[email protected]+"["[email protected]+"]")); if(getiteminfo([email protected],2)>-1) if(set([email protected],countitem([email protected]))) { set [email protected]$, [email protected]$+getitemname([email protected])+" x"[email protected]+":"; set [email protected],[email protected]+1; set [email protected][[email protected]], [email protected]; } } if([email protected]$=="") { mes .npc$; mes "Hmm, you don't seem to have any enchantment orbs for that equipment."; close; } mes .npc$; mes "Please, select an enchantment from the menu."; next; select([email protected]$); set [email protected], [email protected][@menu]; set [email protected]$, ""; set [email protected], 0; while((set([email protected],[email protected]+1)-1)<4) { setd("[email protected]"[email protected], getequipcardid([email protected]_loc,[email protected])); if(getequipcardid([email protected]_loc,[email protected])) set [email protected]$, [email protected][email protected]+.crd_c$[[email protected]]+" Slot- [^a92435"+getitemname(getequipcardid([email protected]_loc,[email protected]))+"^000000]:"; else set [email protected]$, [email protected][email protected]+.crd_c$[[email protected]]+" Slot- [^30ad25Empty^000000]:"; } mes .npc$; mes "Select a slot."; next; set([email protected],select([email protected]$)-1); set [email protected], getequiprefinerycnt([email protected]_loc); if(getequipcardid([email protected]_loc,[email protected])) { mes .npc$; mes "Would you like me to remove this card?"; next; if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; } getitem getequipcardid([email protected]_loc,[email protected]),1; delitem2 [email protected]_itm, 1, 1, [email protected], 0, [email protected], [email protected], [email protected], [email protected]; setd("[email protected]"+(@menu+1), 0); getitem2 [email protected]_itm, 1, 1, [email protected], 0, [email protected], [email protected], [email protected], [email protected]; } if(rand(101)>.perc[[email protected]]) { mes .npc$; mes "I'm sorry but I've failed you!"; misceffect 155; emotion e_sob,0; set Zeny,Zeny-.pric; close; } set Zeny,Zeny-.pric; delitem [email protected],1; delitem2 [email protected]_itm, 1, 1, [email protected], 0, [email protected], [email protected], [email protected], [email protected]; setd("[email protected]"+(@menu+1), [email protected]); getitem2 [email protected]_itm, 1, 1, [email protected], 0, [email protected], [email protected], [email protected], [email protected]; misceffect .efet; emotion e_no1,0; mes .npc$; mes "All done!"; equip [email protected]_itm; close; //NPC Constants OnInit: //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-= set .npc$ , "[^0000FFEnchant Expert^000000]"; // NPC Name set .pric , 1000000; // Price set .efet , 154; // Effect Number setarray .perc , 100,80,50,10; // Percent slot setarray .crd_c$, "st", "nd", "rd", "th"; // Count setarray .itm32 , 4760; // Sheilds setarray .itm16 , 4761; // Armor setarray .itm4 , 4762; // Garment setarray .itm64 , 4763, 4764; // Footgear setarray .itm128 , 4765; // Accessory1 setarray .itm10 , 4766; // Accessory2 setarray .itm2 , 4765; // Weapon setarray .itm1 , 4766; // Low Headgear setarray .itm512 , 4767; // Mid Headgear setarray .itm256 , 4767; // Upper Headgear setarray .eqp$ , "Upper Headgear", "Mid Headgear", "Low Headgear", "Armor", "Left Hand", "Right Hand", "Garment", "Shoes", "Accessory1", "Accessory2"; setarray .equiploc, EQI_HEAD_TOP, EQI_HEAD_MID, EQI_HEAD_LOW, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R; set .e_len , getarraysize(.eqp$); //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-= } Working version.
  22. @Z3R0 I know I've already said this but welcome back... (You might want to consider fixing your signature xD) It's always great to see some of the older people coming back.
  23. @Olrox It's good to see you posting again. Fantastic work again.
  24. I feel like @Cydh did a @storagegetitem or something... I know there is a command to delete items from storage and count them. https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L4697-L4698 https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L4764-L4765 I also did a mod to add items to guild storage but it's old so I'm not sure if it still works but you could use that as a base.
  25. Don't worry about it someone else might have the same question later on. @Kaze has a good answer so I'll mark that.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.