[REQUEST] - how to add silks to new created chars ?

03/13/2012 06:25 multiuses#1
hi
i just wonder if i canadd silks to new created chars in VSRO server ?
if anyone know how to do this please answer me and i will be so glad
thanks
03/13/2012 10:44 Shifty*#2
You will need a .php script to do that for you, one has already been released so use the search function.
03/13/2012 11:45 pulpcorn#3
what do u want man?
char or account?
silk only stored in account.

If you wanted to add silk when they created new char in game... you'ld check a look at trigger Insert in SQL Server => table _Char will be inserted new char's information so you detect it and find their JID.
if you wanted to add silk when they created new account... then you have to check a look at this query: INSERT INTO *silk_table* VALUES(*options here*).
Ex: My table is SK_Silk and I had 4 columns, my query will be liked this: Insert into SK_Silk values('" + IDUSR + "', 0, '2', 0)

Btw... you also make sure that account already had silk or not.... if had... just UPDATE *silk_table* SET *silk_column* = *slik_amount* WHERE JID = *account's JID*
03/13/2012 12:15 SunSoon#4
Lol i wanna to knw how to add silks to new created Chars !!

But i dont understand any Comment There >.<
03/13/2012 19:55 pulpcorn#5
Firstly, I want you to make sure this thing: Silk only stores in Account
Secondly, if you want to add silk to new created Char... it means that your Silk can multiply five times (max number of Char in Account), because silk affects in Account, not Char!
Ex: You want to add 2 silk when they created new Char in xyz's account. If they created 5 characters, xyz's account would earn 10 silk => all of char in xyz's account could use that silk!
Finally, if you're sure what do you want... so let's begin!

*note: You should know a little bit MSSQL query and Trigger (for insert) => if you don't know it, go google!

Relational databases: SRO_VT_ACCOUNT and SRO_VT_SHARD
Relational tables: SK_SILK and _CHAR AND _USER

Description: When you created new char in game, _Char's table will be inserted new record to last row! (I guess client send request to server to let it know insert new record into _Char's table)
1> Create new Trigger for Insert and get last CharID's column record.
PHP Code:
CREATE TRIGGER trgAddSilk
ON SRO_VT_SHARD
.._CHAR FOR INSERT 
AS
DECLARE @
CHARID int;
SET @CHARID = (SELECT TOP (1CHARID FROM SRO_VT_SHARD.._CHAR ORDER BY CHARID DESC); 
2> When you have Character's CharID, go to table _USER in SRO_VT_SHARD and find their UserJID.
PHP Code:
DECLARE @USERJID int;
SET @USERJID = (SELECT USERJID FROM SRO_VT_SHARD.._USER WHERE CHARID = @CHARID
3> When you have Account's UserJID, go to table SK_SILK in SRO_VT_ACCOUNT and let's insert or update silk through their JID.
PHP Code:
INSERT INTO SRO_VT_ACCOUNT..SK_SILK VALUES (@USERJID020//2 is amount of silk you want to add 
or
PHP Code:
UPDATE SRO_VT_ACCOUNT..SK_SILK SET SILK_GIFT SILK_GIFT 2 WHERE JID = @USERJID //2 is amount of silk you want to add 
***>>> Finish Trigger!

FULLY CODE
PHP Code:
CREATE TRIGGER trgAddSilk
ON SRO_VT_SHARD
.._CHAR FOR INSERT 
AS
    DECLARE @
CHARID int;
    
SET @CHARID = (SELECT TOP (1CHARID FROM SRO_VT_SHARD.._CHAR ORDER BY CHARID DESC);
    DECLARE @
USERJID int;
    
SET @USERJID = (SELECT USERJID FROM SRO_VT_SHARD.._USER WHERE CHARID = @CHARID);
    IF (
SELECT COUNT(*) FROM SRO_VT_ACCOUNT..SK_SILK WHERE JID = @USERJID) > 0
        UPDATE SRO_VT_ACCOUNT
..SK_SILK SET SILK_GIFT SILK_GIFT 2 WHERE JID = @USERJID;
    ELSE
        
INSERT INTO SRO_VT_ACCOUNT..SK_SILK VALUES (@USERJID020); 
This is a basic code to let you add silk when you created new char in game!
Ofc you have to test it if you decide to use it!

Say Thanks if you see my post is usefull!
03/13/2012 21:46 Dr.Abdelfattah#6
very simple query
[Only registered and activated users can see links. Click Here To Register...]
03/14/2012 03:27 pulpcorn#7
@Dr.Abdelfattah: He wants to add silk to each created char, not registed user :)
that's why I wanted him to make sure what's really things he wants...