[Euphoria Dev Team Tiny Release] Custom GM commands

10/07/2013 00:13 nubness#1
Hey folks,

I've seen a couple of releases and prototypes of custom GM commands released here, which some have been using, and which I personally consider terrible. Those aren't proper commands, in fact they are just random text that trigger the chat logs, and which also show up in the normal chat. This release contains a technique used by us, the Shaiya Euphoria administration team a while ago.

This isn't a perfect way to create your custom commands, it can certainly be done in a better way, but this will hopefully open people's eyes to what other things can be possibly done.

You're gonna have to insert the following code snippet into PS_GameLog.dbo.usp_Insert_Action_Log_E:
Code:
IF @ActionType = 180
BEGIN	
	IF @Text1 = 'NoticeTo' AND EXISTS (SELECT CharName FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
	BEGIN
		IF @Text3 LIKE '+% points.'
		BEGIN
			DECLARE @Text3var VARCHAR(100) = SUBSTRING(@Text3, 2, LEN(@Text3) - 9)
			DECLARE @Points INT = CAST(@Text3var AS INT)

			UPDATE PS_UserData.dbo.Users_Master
			SET Point += @Points
			WHERE UserUID IN (SELECT UserUID FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
		END

		ELSE IF @Text3 LIKE '%ban%'
		BEGIN
			UPDATE PS_UserData.dbo.Users_Master
			SET Status = -5
			WHERE UserUID IN (SELECT UserUID FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
		END
	END
END
This is just a sample of 2 commands, banning and adding donation points. As I assume most of you know, ActionType 180 stands for the commands used from in game. Text1 as 'NoticeTo' means it was a private notice, which is send from in game as /wnotice charname "notice text", for example /wnotice nubness "You suck, nubness.", which will make [Notice]You suck, nubness. appear on the screen of any character named nubness.
You can change the syntax of /wnotice to anything like /cstmcmd or anything else in the game.exe, by opening it in hex and searching for /wnotice.

Back to the SQL part, what does my code snippet do ? It checks for all commands used in game. If the command is a private notice and is addressed to an existing character, it proceeds to checking what the notice text is. The first case checks if the text contains '+% points.' To translate this from SQL to english, it will trigger if the text contains a +, followed by something, which should be a number, a space and the word points, ending with a full stop. An example would be "+100 points.". If the check fails, it moves to the next case of the IF block, which checks if the text contains the word ban. It could be anything from "ban" to "You have been banned, bitch !"

Again, if you want to award Mr.X 1000 donation points, you type:
/wnotice Mr.X "+1000 points."
or perhaps you want to ban Mr.X, you type:
/wnotice Mr.X "You have been banned."

I do believe this form is much more professional that what existed until now. One disadvantage could be the fact that it only works with online toons, but hey, let's turn on our imagination and make this accept map notices that were submitted from a map where only GMs can be, which would have a global power, and which nobody but people on that map would see.

Free your mind, people, development is easy !
10/07/2013 05:17 erickreq#2
gracias amigo xD
10/07/2013 09:28 SvHe#3
Nubness , im still learning SQL so yeah my script is not that great , but i tought it can be usefull for people that are not masters in sql like me . Thanks anyways to make it better for people and hopefully my next script will satisfy u more :)
Take care ,
SvHe
10/07/2013 14:44 Hep#4
Eh, Added to [Only registered and activated users can see links. Click Here To Register...]
10/07/2013 20:54 Shànks♠#5
Nice release!
10/08/2013 17:42 TeddyBear94#6
Quote:
Originally Posted by RedDuty View Post
Nice release!
stop posting that under each release >_> u got a thanks button for that
10/11/2013 15:39 nick4ever#7
Wow, amazing nubness.Thank you. Can I just use this way to kick a player out of game via SQL?
10/11/2013 15:45 nubness#8
Quote:
Originally Posted by nick4ever View Post
Wow, amazing nubness.Thank you. Can I just use this way to kick a player out of game via SQL?
Thank you for the appreciation.

For kicking the player you can simply use the /kick command. So the best course of action for kick-banning someone would be using this ban command, followed by the kick command.
10/12/2013 06:15 nick4ever#9
@nubness: Thank you, you have helped me a lot. However, I know that I can use kick command when I m in game with GM toon, the thing I need is use this your release to kick a player via SQL automatically. This problem I posted a topic before, then you and someone came help me, but it caused to SQL rollback. Finally, I gave up, and tried to build a server and client socket application to detect that a player use Cheat Engine or not. I could use my TCP Killer to kick that IP, but whole range IP, it meant if that IP had 5 players, they are all kicked. I m trying to work around kicking a specific a player through SQL but no roll back. hiz hiz

Anyway, thank you in advance nubness
10/12/2013 10:38 nubness#10
Well, I've created an auto kicker, but it requires RDC to be opened for working properly, so I won't release it, at least for now.
10/12/2013 11:15 nick4ever#11
U meant something like autoIT, type /kickcid in PSM_Manager? I tried but failed. Anyway, thank you nubness :*
10/12/2013 14:10 Stureplan#12
#Added to Index.
11/27/2016 00:38 evalbrito#13
Msg 139, Level 15, State 1, Procedure usp_Insert_Action_Log_E, Line 0
Cannot assign a default value to a local variable.
Msg 139, Level 15, State 1, Procedure usp_Insert_Action_Log_E, Line 0
Cannot assign a default value to a local variable.
Msg 137, Level 15, State 2, Procedure usp_Insert_Action_Log_E, Line 95
Must declare the scalar variable "@Points".

[Only registered and activated users can see links. Click Here To Register...]
It does not work
03/23/2017 23:16 mambomambo1#14
I have the same problem as evalbrito has,can you please help us ?

I tryed to fix the problem
Quote:
DECLARE @ActionType BIGINT
SET @ActionType = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
DECLARE @Text1 BIGINT
SET @Text1 = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
DECLARE @Text3 BIGINT
SET @Text3 = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
DECLARE @Text2 BIGINT
SET @Text2 = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
DECLARE @Points BIGINT
SET @Points = ABS(CAST(HASHBYTES('SHA1',CAST(NewID() AS NVARCHAR(MAX))) AS BIGINT))
IF @ActionType = 180
BEGIN
IF @Text1 = 'NoticeTo' AND EXISTS (SELECT CharName FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
BEGIN
IF @Text3 LIKE '+% points.'
BEGIN
DECLARE @Text3var VARCHAR(100) = SUBSTRING(@Text3, 2, LEN(@Text3) - 9)
DECLARE @Points INT = CAST(@Text3var AS INT)

UPDATE PS_UserData.dbo.Users_Master
SET Point += @Points
WHERE UserUID IN (SELECT UserUID FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
END

ELSE IF @Text3 LIKE '%ban%'
BEGIN
UPDATE PS_UserData.dbo.Users_Master
SET Status = -5
WHERE UserUID IN (SELECT UserUID FROM PS_GameData.dbo.Chars WHERE CharName = @Text2 AND Del = 0)
END
END
END

Error :
Quote:
Msg 139, Level 15, State 1, Line 0
Cannot assign a default value to a local variable.
Msg 139, Level 15, State 1, Line 0
Cannot assign a default value to a local variable.
Msg 102, Level 15, State 1, Line 21
Incorrect syntax near '+'.
03/24/2017 01:51 wurstbrot123#15
Nice release but i would never use unfiltered Text for querys. Trust is good, security is better :3