Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 14:28

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

 

SQL Query from LUA

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
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   #2
 
elite*gold: 36
Join Date: Oct 2014
Posts: 11
Received Thanks: 3
hmm try this


DARK-REVO is offline  
Old   #3
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
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   #4
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
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   #5
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
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   #6
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
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   #7
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
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   #8
Moderator
 
elite*gold: 1
Join Date: Dec 2012
Posts: 3,041
Received Thanks: 977
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   #9
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
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   #10
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
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   #11
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
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   #12
 
elite*gold: 0
Join Date: May 2013
Posts: 129
Received Thanks: 12
Anyway thank you for trying to help me


thund22222 is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
Anyone help me out with this query?
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...
0 Replies - EO PServer Hosting
[HELP]how to use query
i want add equipment and pet to my DB,,,who can help me how to add equipment at database in picture step by step...
1 Replies - EO PServer Hosting
Query
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...
9 Replies - Metin2 PServer - Discussions / Questions
[Suche]Query für "Alteklinge, Reichsklinge" &' Stichdolche NUR QUERY!
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...
1 Replies - Metin2 PServer - Discussions / Questions



All times are GMT +2. The time now is 14:28.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.