Jump to content

Skorm

Forum Moderator
  • Posts

    1268
  • Joined

  • Last visited

  • Days Won

    33

Everything posted by Skorm

  1. Skorm

    @noheadgear

    I don't think something like this can be done with scripts alone at least. This might be like a client / source mod. Gunna move it over there.
  2. @IvanD Please articulate your question. Edit: After reading the topic again. I think he's maybe asking for a player owned npc shop and when one player purchases an item from the shop. The owner gets an item too? Or something along those lines.
  3. I'm pretty sure for that you would need a dynamic shop npc. https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ea-addicts/Daily TCG Shop.txt I made a script similar to this (forever ago) except the items for sale rotate daily. Although stock gets reset when the server restarts.
  4. @ZelosAvalon I updated my previous post. This isn't the entire event though. It's just a way of collecting 10 different players in a list and then warping them in groups of two to different maps. You'll have to figure out the rest unless someone else wants to spend the time building you an event.
  5. I don't really have a lot of time to code it all out or whatever... Or even test but this is a quick example I came up with. prontera,163,187,6 script dual warp 100,{ .@len = getarraysize(.waiting_list$); if( !.init && !compare("|"+implode(.waiting_list$,"|")+"|", "|"+getcharid(0)+"|") ) { .waiting_list$[.@len] = ""+getcharid(0); .@len++; npctalk .@len + ""; if( .@len == 10 ) { .init = 1; .@map_len = getarraysize(.maps$); copyarray .@maps$,.maps$,.@map_len; copyarray .@cordx,.cordx,.@map_len; copyarray .@cordy,.cordy,.@map_len; while( .@len ) { .@rng = rand(.@len); .@map_rng = .@rng % .@map_len; .@map$ = .@maps$[ .@map_rng ]; .@x = .@cordx[ .@map_rng ]; .@y = .@cordy[ .@map_rng ]; warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]); deletearray .waiting_list$[.@rng], 1; .@len--; .@rng = rand(.@len); warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]); deletearray .waiting_list$[.@rng], 1; deletearray .@maps$[ .@map_rng ], 1; deletearray .@cordx[ .@map_rng ], 1; deletearray .@cordy[ .@map_rng ], 1; .@map_len--; .@len--; } .init = 0; } } end; OnInit: setarray .maps$, "prontera", "izlude", "geffen", "comodo", "amatsu"; setarray .cordx, 10, 100, 50, 20, 40; setarray .cordy, 10, 100, 50, 20, 40; }
  6. @Balfear It's what I've come to expect and that's not a bad thing.
  7. 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.
  8. @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
  9. Wrong section. Moved to "Source Support".
  10. Wrong section. Moved to "Scripting Support".
  11. 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 { .@map$ = getarg(0); freeloop(1); do { .@rXr = rand(getarg(1)); .@rYr = rand(getarg(2,getarg(1))); } while (checkcell(.@map$,.@rXr,.@rYr,cell_chkwall) || checkcell(.@map$,.@rXr,.@rYr,cell_chkcliff) || checkcell(.@map$,.@rXr,.@rYr,cell_chknopass) || checkcell(.@map$,.@rXr,.@rYr,cell_chknoreach)); return (.@rXr<<12)+.@rYr; } - 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(.@tmp_ary$,strnpcinfo(2),"|"); .@walkable_xy = fWalkable(strnpcinfo(4), atoi(.@tmp_ary$[0]), atoi(.@tmp_ary$[1])); .@y = .@walkable_xy & 4095; .@x = .@walkable_xy >> 12; movenpc strnpcinfo(0), .@x, .@y; 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
  12. 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. :)

  13. 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: .@len = getarraysize(.customs); // Get the number of customs we've added. .@b_len = getarraysize(@bought_nameid); // Get the number of purchased items. for( set @i, 0; @i < .@len; set @i, @i+1 ) { // Loop through all our custom items. for( set @d,0; @d < .@b_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 .@i, 0; .customs[.@i]; set .@i, .@i+1 ) // Loop through our custom items. npcshopadditem "custom_seller2",.customs[.@i],.Price[.@i]; // Add our custom items to the cleared dummy shop. end; }
  14. 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...
  15. query_sql("INSERT INTO `event_rewards` ( `account_id`, `event_name`, `id`, `amount`, `value` ) VALUES ( "+.@account_id[.i]+", '"+.@eventname$+"', "+.@prize[.j]+", "+.@pamount[.k]+", 0) ");
  16. You only need escape_sql when dealing with string variables. .@id is a integer variable so nobody can put an escape character like "; or something to cause harm to your database. if the variable was .@id$ and a user put text for that .@id$ variable like '; DROP TABLE `accounts`; MySQL would read select `field` from `table` where `field` = ''; DROP TABLE `accounts`;
  17. '"+@NewName$+"' 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)"+(.@npc_string_variable$)+"(Enter NPC String) (End SQL String)' (End NPC String)"
  18. 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); }
  19. atoi stands for ASCII to Integer. String -> Number getitemname uses an integer value you don't need to use atoi.
  20. I just tested the exact script you posted it works fine on my server np.
  21. 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 += "+@kills+", deaths += "+@deaths+" 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.
  22. 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.
  23. Post the code you're testing in full.
  24. 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
  25. 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.
×
×
  • Create New...