Quit Current Guild Script

07/24/2015 18:16 [GM]Precious#1
Hi guys,

Anyone can point me where to quit the current guild of the account using Script?

I formulated a procedure it will update it as Del from the guild but when I login still the guild not removed.

here is my simple procedure.

BEGIN
--update del = 1 and set leave date
UPDATE PS_GameData.dbo.GuildChars SET Del = 1, LeaveDate = GETDATE()
WHERE CharID IN (SELECT CharID FROM PS_GameData.dbo.Chars WHERE UserID=@UserID)
AND LeaveDate IS NULL
--update total guild members
UPDATE PS_GameData.dbo.Guilds SET TotalCount=TotalCount-1
WHERE GuildID IN (Select GuildID From PS_GameData.dbo.GuildChars where CharID IN (SELECT CharID FROM PS_GameData.dbo.Chars WHERE UserID=@UserID))
END
07/24/2015 18:42 SnickQ#2
Code:
UPDATE PS_GameData.dbo.GuildChars SET Del = 1, JoinDate=2014-05-03 19:25:23.500
where CharID IN (SELECT CharID FROM PS_GameData.dbo.Chars WHERE UserID=@UserID) and LeaveDate is not null
07/24/2015 19:22 [GM]Precious#3
Thank you for pointing in LeaveDate is not null, but it should be LeaveDate IS NULL

Anyway it doesnt fix quit the guild when I login the character. But in database it is already deleted in GuildChars as Del = 1




This is for SnickQ.

If I use LeaveDate IS NOT NULL as what you pointed out. All the previous quitted guild LeaveDate will be updated as well.

So I use LeaveDate IS NULL so that It will update only the current date that Del = 1 was set.

RowID GuildID CharID GuildLevel Del JoinDate LeaveDate
2208 4 5697 9 1 2014-11-24 19:45:43.883 2015-07-25 01:17:00.850
27782 28 5697 9 1 2014-12-15 03:59:14.730 2015-07-25 01:17:00.850
31866 5 5697 9 1 2014-12-18 20:25:41.257 2015-07-25 01:17:00.850
44814 35 5697 6 1 2014-12-27 16:17:37.723 2015-07-25 01:17:00.850
101051 124 5697 7 0 2015-01-29 21:37:39.643 NULL
07/24/2015 19:41 nubness#4
Everything guild related is executed and stored in the ps_game memory, then saved in the database, therefore this SQL query requires a restart in order to be effective.
07/24/2015 19:44 SnickQ#5
That should work after log out, because to update database you need relog
And thad should be IS NOT NULL because if will be null player in db is not leave guild
[Only registered and activated users can see links. Click Here To Register...]
07/24/2015 20:05 nubness#6
Quote:
Originally Posted by SnickQ View Post
That should work after log out, because to update database you need relog
It won't work. The server memory reads that information from the database only when the server starts, and after that it only updates the database, but never reads again.
07/24/2015 20:22 [GM]Precious#7
Thank you Nubness.

When you say everything guild related, Does it mean we cannot create an sql script to kick a character from the guild?


Is there a storedprocedure we can exec and send an ActoinType 179 to Quit/Leave from Guild?
07/24/2015 22:36 nubness#8
Quote:
Originally Posted by [GM]Precious View Post
Thank you Nubness.

When you say everything guild related, Does it mean we cannot create an sql script to kick a character from the guild?


Is there a storedprocedure we can exec and send an ActoinType 179 to Quit/Leave from Guild?
That's right, such things cannot be handled from the database, unless you're restarting the server after the changes. You can do these things only directly by injecting the ps_game.exe.
07/24/2015 23:10 [GM]Precious#9
Again thank you.
I need to do a lot of search and will be learning on how manipulate/write/injecting the ps_game.exe

Quote:
Originally Posted by SnickQ View Post
That should work after log out, because to update database you need relog
And thad should be IS NOT NULL because if will be null player in db is not leave guild
[Only registered and activated users can see links. Click Here To Register...]
If I use LeaveDate IS NOT NULL as what you pointed out. All the previous quitted guild LeaveDate will be updated as well.

So I use LeaveDate IS NULL so that It will update only the current date that Del = 1 was set.

RowID GuildID CharID GuildLevel Del JoinDate LeaveDate
2208 4 5697 9 1 2014-11-24 19:45:43.883 2015-07-25 01:17:00.850
27782 28 5697 9 1 2014-12-15 03:59:14.730 2015-07-25 01:17:00.850
31866 5 5697 9 1 2014-12-18 20:25:41.257 2015-07-25 01:17:00.850
44814 35 5697 6 1 2014-12-27 16:17:37.723 2015-07-25 01:17:00.850
101051 124 5697 7 0 2015-01-29 21:37:39.643 NULL