Jump to content
  • 0

Grant items to players


Talaysen

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  161
  • Reputation:   5
  • Joined:  02/07/13
  • Last Seen:  

I'd like to grant a couple of items to all of my players, and I'm trying to figure out the best way to do this.

I was looking at the 'Utility: Promotional Codes", which seemed promising, but people could keep creating accounts and redeeming that code, as there's no way to limit a code to a particular level or other similar requirement.

 

So, seems like the best option available would be to manually grant the items.

I should be able to do this through an SQL query, I'd imagine, but what's the best method?

I don't want to add items to player inventories, as I imagine if their inventory is full, it would be a problem.

 

It seems like adding items to storage is equally complicated, requiring that you check that their storage isn't full.

 

Is it possible to create/send mail to all players with their items?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  161
  • Reputation:   5
  • Joined:  02/07/13
  • Last Seen:  

Any suggestions appreciated. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   32
  • Joined:  05/29/12
  • Last Seen:  

im not sure if it's possible to send items with mail from a script. 

Never tested it or thougt about it.

 

To check player level to make the code useable is easy, also check inventory / storage status.

 

If you want this as a ingame script (when the player spawn as example) i could make you one.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  161
  • Reputation:   5
  • Joined:  02/07/13
  • Last Seen:  

We had some intermittent downtime issues over the past few weeks and I wanted to reward all of the players with a little bonus, likely some exp manuals/bubblegums.

I was hoping to just grant the items with an SQL query, instead of implementing any new scripts, albeit, if that's what needs to be done, I suppose that'd be fine.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   32
  • Joined:  05/29/12
  • Last Seen:  

It is possible with a sql query, but a script would be easyer and wouldnt make many problems aaaand faster.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   1
  • Joined:  06/29/13
  • Last Seen:  

I suggest to you to do this via NPC Script PLUS SQL Query, since in MySQL the loop's condition (while, for) is not so easy.

 

Well I'm not an expert in SQL and I strongly suggest to do this on a secondary db. Here is the logic:

In Inventory you have each rows a unique player item. So to do that you must run a query that goes to the first "char_id" to the last one, creating each row for each player. So if you have 50 players, the loop will run 50 times.

 

    for(set @i, 150000, set @j, 3; @i <= 150060; set @i, @i + 1, set @j, @j + 1){
  
    query_sql " INSERT INTO `inventory`(`id`, `char_id`, `nameid`,
`amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`,
`card2`, `card3`, `expire_time`, `favorite`, `bound`, `unique_id`)
VALUES ("+@j+","+@i+",ITEM ID,AMOUNT,0,0,0,0,0,0,0,0,0,0,0,0)";
    }

 

Mine for example:

sql_zpse85c83a1.png

 

If I had 5 players, will start at 150000 and end at 150005. And I need to respect the ID order.

 

Hope you get it, I dont know if this is correct :)

 



 

Edited by puding
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...