Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Tutorial :how to ADD Item to players on your server by query.

Newbie Spellweaver
Joined
Jan 9, 2016
Messages
16
Reaction score
0
If I understand what you're saying, I'm not sure as I haven't messed around with starter packages. Experiment! :)

ill try to add more info maybe you know either way ;)

USE C9World

INSERT INTO Game.TblPcMail(cPcNo, cMailType, cSubjectKey, cContentKey, cFromPcName, cSubject, cContent, cMoney, cSerialNo)
VALUES(2, 1, 0, 0, 'Keleen', 'RZItemWork', 'RZItemWork', 0, 658)

INSERT INTO Game.TblItem (cItemId, cPosition, cOwnerNo, cStckCnt, cDur, cOwnerTabNo, cGuildGrade, cIsSealed)
VALUES(15677, 6, 2, 1, 30, 0, 0, 0)

this line
VALUES(2, 1, 0, 0, 'Keleen', 'RZItemWork', 'RZItemWork', 0, 658)
instead of providing senders ID and name is it possible to leave it on defult @ <-- like so and just provide a false name so basically when a new char will be created he will be able to get his goodies from the mail area and not inventory

 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
ill try to add more info maybe you know either way ;)

USE C9World

INSERT INTO Game.TblPcMail(cPcNo, cMailType, cSubjectKey, cContentKey, cFromPcName, cSubject, cContent, cMoney, cSerialNo)
VALUES(2, 1, 0, 0, 'Keleen', 'RZItemWork', 'RZItemWork', 0, 658)

INSERT INTO Game.TblItem (cItemId, cPosition, cOwnerNo, cStckCnt, cDur, cOwnerTabNo, cGuildGrade, cIsSealed)
VALUES(15677, 6, 2, 1, 30, 0, 0, 0)

this line
VALUES(2, 1, 0, 0, 'Keleen', 'RZItemWork', 'RZItemWork', 0, 658)
instead of providing senders ID and name is it possible to leave it on defult @ <-- like so and just provide a false name so basically when a new char will be created he will be able to get his goodies from the mail area and not inventory


You should be able to, yes, it's just a string value so you could call it 'Admin' or 'ItemsBot' or whatever you like. The only circumstance I can see using '@' being an issue is if the DB doesn't like storing symbol values in the string and refuses to parse it. But you won't know that until you try, ;). But yes, if you're running a web registration script you can just use those queries in PHP with a random 'From' user value, replace the content with 'Welcome to the game, enjoy a small welcome gift!' or similar, you'll just need to run a query to pick the highest ID value and then create the item.

In my example I manually searched to know I needed to use 658, but if you have 10 people playing on the server they will be getting item drops and such, which will fill that table with new IDs and you might create a duplicate or the script may fail. So you need to do a query to select the MAX of the cSerialNo at the time the query runs and then make the new one that value + 1.
 
Newbie Spellweaver
Joined
Jan 9, 2016
Messages
16
Reaction score
0
You should be able to, yes, it's just a string value so you could call it 'Admin' or 'ItemsBot' or whatever you like. The only circumstance I can see using '@' being an issue is if the DB doesn't like storing symbol values in the string and refuses to parse it. But you won't know that until you try, ;). But yes, if you're running a web registration script you can just use those queries in PHP with a random 'From' user value, replace the content with 'Welcome to the game, enjoy a small welcome gift!' or similar, you'll just need to run a query to pick the highest ID value and then create the item.

In my example I manually searched to know I needed to use 658, but if you have 10 people playing on the server they will be getting item drops and such, which will fill that table with new IDs and you might create a duplicate or the script may fail. So you need to do a query to select the MAX of the cSerialNo at the time the query runs and then make the new one that value + 1.
this is what i was talking about cSerialNo from what i know if it will stay @cSerialNo like so, it will not count any number am i correct? instead of provide a number ID like u did 658 if it will stay @cSerialNo it will be just blank am i correct?
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
this is what i was talking about cSerialNo from what i know if it will stay @cSerialNo like so, it will not count any number am i correct? instead of provide a number ID like u did 658 if it will stay @cSerialNo it will be just blank am i correct?

I think I understand you now. Are you saying if you make the item once in the DB, like cSerialNo 658, can you reuse it? I don't think so, because each item is assigned to a character value and has a limited span of days. You need to make the item each time, for each member, as the welcome gift.
 
Newbie Spellweaver
Joined
Jan 9, 2016
Messages
16
Reaction score
0
I think I understand you now. Are you saying if you make the item once in the DB, like cSerialNo 658, can you reuse it? I don't think so, because each item is assigned to a character value and has a limited span of days. You need to make the item each time, for each member, as the welcome gift.
so is it possible to make it update by itself per new character lets say as for rightnow the serial is 99 new player was created and it updates it automaticly to 100 serial and send him the gift another player was created now its 101 same item 102 103 .. hopefully i explained my self right lol thank you for the support tho.
 
Put Community First
Loyal Member
Joined
Oct 2, 2014
Messages
1,112
Reaction score
832
so is it possible to make it update by itself per new character lets say as for rightnow the serial is 99 new player was created and it updates it automaticly to 100 serial and send him the gift another player was created now its 101 same item 102 103 .. hopefully i explained my self right lol thank you for the support tho.

Yep, I understand that, thanks for rephrasing, :). The only way I can think of doing this is the following:

1) Make an additional field for the characters DB table; cWelcomeGift with a default of 0.
2) Have a web script/stored procedure check this DB each minute for characters that have cWelcomeGift set to 0.
3) Make the above web script/stored procedure check item DB table cSerialNo and add 1 to the max for the new item.
4) Have the web script/stored procedure use a query to add the item to the character via the mail system where cWelcomeGift is 0.
5) Make the web script/stored procedure set the cWelcomeGift for the relevant character/s to 1, meaning they received it.
 
Newbie Spellweaver
Joined
Mar 10, 2016
Messages
8
Reaction score
1
Hello guys, is it possible to add an option for when a new character is created, that it appears with full inv slots? (126). And how to add a specific legend to a character? Thank you.
 
Last edited:
Back
Top