Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 16:44

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



SQL Query from LUA

Discussion on SQL Query from LUA within the Rappelz Private Server forum part of the Rappelz category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
SQL Query from LUA

I have worked with the idea of @mongreldogg but i have a problem does not describe the thread guide
if you want to modify, for example, in-game gold, just type the command mssql_query ("update Character set gold = 100 where account = test") but if you want to link to the tool through the function how do I bring the player's account name in lua
i have many experiences in lua script for example
account_name = gv("account")
mssql_query ("update Character set gold = 100 where account = "..account_name)
The result is a server crash

anyhelp how can i do it?
thund22222 is offline  
Old 05/03/2015, 16:37   #2
 
elite*gold: 36
Join Date: Oct 2014
Posts: 13
Received Thanks: 4
hmm try this
DARK-REVO is offline  
Old 05/03/2015, 19:59   #3
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
Quote:
Originally Posted by DARK-REVO View Post
hmm try this
ok this code will be executed
mssql_query("UPDATE [dbo].[SQLLUA] SET [winners] =0
but , this ?!! How the server will bring a player name?
WHERE 1=1
thund22222 is offline  
Old 05/03/2015, 22:24   #4
 
TheSuperKiller's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 278
Received Thanks: 73
you have global flags and its procedures you can make magic with it, just think from another perspective, for example ( if in_key like blah blah exec blah blah that contains where "in_value" )

Mongreldogg gave you amazing idea just use logic to modify it as you want, not using it as it is .
TheSuperKiller is offline  
Old 05/04/2015, 19:09   #5
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
Quote:
Originally Posted by TheSuperKiller View Post
you have global flags and its procedures you can make magic with it, just think from another perspective, for example ( if in_key like blah blah exec blah blah that contains where "in_value" )

Mongreldogg gave you amazing idea just use logic to modify it as you want, not using it as it is .
hmm ok
but how can the server bring the account name by using the tool?
Where "in_value"-a – > This means the variable I will enter into the mssql
function
thund22222 is offline  
Old 05/04/2015, 23:31   #6
 
TheSuperKiller's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 278
Received Thanks: 73
Quote:
Originally Posted by thund22222 View Post
hmm ok
but how can the server bring the account name by using the tool?
Where "in_value"-a – > This means the variable I will enter into the mssql
function
think outside the box ... edit the procedure itself.

if in_key like '%_bringusername'
exec blah blah where in_value 'his name'

and all that blah blah is the sql query which will do everything from his name .

it's all about minds and proper logic use .
TheSuperKiller is offline  
Old 05/05/2015, 00:23   #7
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
you cannot do this because the server can not bring a player's account name
you can apply what you said, but you must enter the account name the player manually
in this case would be 500 + Player how you can enter in a short time?
I'll explain you ---->the example I'm going to change the value of the gold via the sql command look at this
update Character set gold = 50 where account_id = 1 ---> this will change all the values in all the characters that have account id 1 ,but if you want to bring the account id of the account that automatically use, value must be the account id = variable
like this in lua script
account_id=gv("account_id")
update Character set gold = 50 where account_id = .. account_id .. ---> now the value of account id variable depending on use
but in sql with lua ?? how can doit? like smp account there is a variable name @IN_ACCOUNT_ID this variable is the value automatically
if this variable is really in smp global variables was solved the problem !!
thund22222 is offline  
Old 05/05/2015, 00:51   #8
Moderator


 
ThunderNikk's Avatar
 
elite*gold: 1
Join Date: Dec 2012
Posts: 4,767
Received Thanks: 1,460
This line brings the player name into the script...

function on_login( name )

All I had to add into on_login.lua to get it to announce my player had logged in is the following

private_notice("".. name .." Has Logged In.")

So now you see it is very easy for lua to pull different variables from the account like character name.

You can probably do the same thing with a function...

function set_gold_ammount (account)

See normally a function contains empty variables like...

function set_gold_ammount ()

Until you define what the variable should be

That's what DARK-REVO was trying to say with this...

function Revo_Lution_Team(name_player)
notice("the winner is .. ,<#ff0000>[ ".. name_player .." ]")
add_state(320006,1,1080000,"".. name_player .."")

mssql_query("UPDATE [dbo].[SQLLUA] SET [winners] =0 WHERE 1=1") -- 0
end

The (name_player) defined the function, I just know mine works with just (name)
ThunderNikk is offline  
Old 05/05/2015, 02:17   #9
 
TheSuperKiller's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 278
Received Thanks: 73
Quote:
Originally Posted by thund22222 View Post
you cannot do this because the server can not bring a player's account name
you can apply what you said, but you must enter the account name the player manually
in this case would be 500 + Player how you can enter in a short time?
I'll explain you ---->the example I'm going to change the value of the gold via the sql command look at this
update Character set gold = 50 where account_id = 1 ---> this will change all the values in all the characters that have account id 1 ,but if you want to bring the account id of the account that automatically use, value must be the account id = variable
like this in lua script
account_id=gv("account_id")
update Character set gold = 50 where account_id = .. account_id .. ---> now the value of account id variable depending on use
but in sql with lua ?? how can doit? like smp account there is a variable name @IN_ACCOUNT_ID this variable is the value automatically
if this variable is really in smp global variables was solved the problem !!

you will never understand what is critical thinking.
you want a ready piece of cake to eat, just like anyone else here in this forum who don't use their minds, so take it :


global flag insert smp :
Code:
if @IN_KEY like '%_change_fucking_gold'
begin
exec ('update telecatser.dbo.Character set gold = 50 where account_id in (select account_id from Character where name = N''' + @IN_VALUE + '''' )
end
lua:
Code:
function change_fucking_gold_using_logic()
name = gv("name")
if get_global_variable("queries_count") == "" then
set_global_variable("queries_count", 0)
end
set_global_variable("queries_count", get_global_variable("queries_count") + 1)
set_global_variable(get_global_variable("queries_count") .. "_change_fucking_gold", name)
end

edit 1 :you can workout this and make another stored procedure to do the stuff in the executing command, but I think it will make brain overload that's why I gave you what you really familiar with like any fake *devs* around here so that you can use your imagination well.
edit 2 : you can rewrite what is included above and make a more efficient script that satisfies all your needs.
TheSuperKiller is offline  
Old 05/05/2015, 16:06   #10
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
Quote:
Originally Posted by TheSuperKiller View Post
you will never understand what is critical thinking.
you want a ready piece of cake to eat, just like anyone else here in this forum who don't use their minds, so take it :


global flag insert smp :
Code:
if @IN_KEY like '%_change_fucking_gold'
begin
exec ('update telecatser.dbo.Character set gold = 50 where account_id in (select account_id from Character where name = N''' + @IN_VALUE + '''' )
end
lua:
Code:
function change_fucking_gold_using_logic()
name = gv("name")
if get_global_variable("queries_count") == "" then
set_global_variable("queries_count", 0)
end
set_global_variable("queries_count", get_global_variable("queries_count") + 1)
set_global_variable(get_global_variable("queries_count") .. "_change_fucking_gold", name)
end

edit 1 :you can workout this and make another stored procedure to do the stuff in the executing command, but I think it will make brain overload that's why I gave you what you really familiar with like any fake *devs* around here so that you can use your imagination well.
edit 2 : you can rewrite what is included above and make a more efficient script that satisfies all your needs.
At the outset, I would like to tell you thanks for the try but sorry if what I wrote the server will crash
it seems that the cake wasn't ready


Seems my friend you have in your collection, which I have labelled (mind out of coverage)Try again to speak with others in a respectful

Note:I put this problem after tests failed
thund22222 is offline  
Old 05/06/2015, 00:41   #11
 
TheSuperKiller's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 278
Received Thanks: 73
Quote:
Originally Posted by thund22222 View Post
At the outset, I would like to tell you thanks for the try but sorry if what I wrote the server will crash
it seems that the cake wasn't ready


Seems my friend you have in your collection, which I have labelled (mind out of coverage)Try again to speak with others in a respectful

Note:I put this problem after tests failed
the query itself causes crash if executed by itself , I gave you the solution approach not the problem analysis.
TheSuperKiller is offline  
Old 05/06/2015, 06:23   #12
 
elite*gold: 0
Join Date: May 2013
Posts: 151
Received Thanks: 14
Anyway thank you for trying to help me
thund22222 is offline  
Reply


Similar Threads Similar Threads
Anyone help me out with this query?
04/14/2014 - EO PServer Hosting - 0 Replies
This is how i have done it ... Anyone know why no matter what i do it skips down to paying out the reward no matter what ...? even without the required tokens it still pays out
[HELP]how to use query
08/07/2011 - EO PServer Hosting - 1 Replies
i want add equipment and pet to my DB,,,who can help me how to add equipment at database in picture step by step...
Query
08/03/2011 - Metin2 Private Server - 9 Replies
Hallo, Ich habe mal eine Query von der Tabelle Player gemacht. Aber ich kann die nicht einfügen. Das heißt wen ich Run drücke und dannach abspeicher steht in der Tabelle immer noch nichts.
[Suche]Query für "Alteklinge, Reichsklinge" &' Stichdolche NUR QUERY!
08/18/2010 - Metin2 Private Server - 1 Replies
Ich weiß ich werd nervig aber ich suche die Query's für Alteklinge, Reichsklinge &' Strichdolche Why? Naya, weil ich in der DB i-wie nur Drachenmaulglocke hab ... not more -.- Auf jeden Fall Icon's etc. etc. etc. hab ich ich brauche nur die Query's



All times are GMT +1. The time now is 16:44.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.