wannabepro Posted April 9, 2012 Share Posted April 9, 2012 i am working on multiplayer online game and i am having some difficulties with basic sql stuff. my system is windows 7 x64 and sql 2005 with SP4 I have script that automatically trades OnlineHours to special cash points "cspoints" in game every hour.Those Points are located in sql dbo.MEMB_INFO under "cspoints" column. What i want to do is,to rewrite this script so it would add me Money and Credits. Money are located in dbo.Character table under column "Money" (memb__id is named AccountID in this .dbo) Credits are located in dbo.MEMB_CREDITS table under column "credits" (memb__id is memb__id) But i am facing few difficulties replacing things in script, because i need to change in one place memb__id from dbo.MEMB_INFO to AccountID from dbo.Character while to keep memb__id from dbo.MEMB_STATS untouched and i am confused where i have to rename it and where to leave it in default state. CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB] @memb___id varchar(10) AS Begin set nocount on Declare @find_id varchar(10) Declare @ConnectStat tinyint declare @OnlineHours real declare @cspoints int Set @ConnectStat = 0 Set @find_id = 'NOT' select @find_id = S.memb___id from MEMB_STAT S INNER JOIN MEMB_INFO I ON S.memb___id = I.memb___id where I.memb___id = @memb___id if( @find_id <> 'NOT' ) begin SELECT @cspoints= cs_points FROM MEMB_INFO where memb___id = @memb___id update MEMB_STAT set ConnectStat = @ConnectStat, DisConnectTM = getdate(), OnlineHours = @cspoints/10+(DATEDIFF(hh,ConnectTM,getdate())) where memb___id = @memb___id SELECT @OnlineHours =OnlineHours FROM MEMB_STAT WHERE memb___id = @memb___id UPDATE [dbo].[MEMB_INFO] SET cs_points=(@OnlineHours * 10) WHERE memb___id = @memb___id end end GO can someone help me out to understand which memb__id in this script is from dbo.MEMB_STAT and which memb__id from MEMB_INFO so i could proceed with my trial to rewrite this script further. here is how my database structure looks like: Quote Link to comment https://forums.phpfreaks.com/topic/260609-trade-onlinehours-for-reward-script/ Share on other sites More sharing options...
fenway Posted April 14, 2012 Share Posted April 14, 2012 Huh? Quote Link to comment https://forums.phpfreaks.com/topic/260609-trade-onlinehours-for-reward-script/#findComment-1337324 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.