Jump to content

Question

Recommended Posts

  • 0
Posted
Use character_variables Sql table:

INSERT INTO character_variables VALUES (playerObjectId, "CustomTitle", titleValue);

  • 0
Posted

I ment, that's the table where Title Colors can be stored.

 

You can do it in this way:

1. While color is changed, run method(done by you) storeTitleColor(player, newTitle); - player variable should be instance of L2PcInstance class(or however you have it called), newTitle should be String containing new Title(for example "FFFFFF")

2. Create private static void method named storeTitleColor and taking 2 arguments(L2PcInstance and String)

3. Create new Database Connection in the method(look for examples of similar usage in your pack, you can search by key words: "INSERT INTO")

4. Create query, that will insert into character_variables. Also think about the case when title is already stored, then you can delete current record(slower way) or add awesome word to query ON DUPLICATE KEY(look in google to know more, also to use it, you should set charId column and var column as Primary Keys.

5. To complete the query, just add statement.executeUpdate(); like in examples you have found.

 

HF

  • 0
Posted (edited)

Connection con = L2DatabaseFactory.getConnection();

Statement st = con.createStatement();

st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x");

 

the x are the getters u have to make from the l2PcInstance

 

code handwritten, maybe there are typos

Edited by xdem
  • 0
Guest Elfocrash
Posted

Connection con = L2DatabaseFactory.getConnection();

Statement st = con.createStatement();

st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x");

 

the x are the getters u have to make from the l2PcInstance

 

code handwritten, maybe there are typos

you obviously need preparedstatement for something like that

  • 0
Posted (edited)

you obviously need preparedstatement for something like that

 

works with statement too, but for this prepared is faster so yes

 

PreparedStatement extends Statement

Edited by xdem
  • 0
Guest Elfocrash
Posted

works with statement too, but for this prepared is faster so yes

 

PreparedStatement extends Statement

Statement cannot support the ?

  • 0
Posted (edited)

Statement cannot support the ?

 

where is the ?

 

both x u have the values from L2PcInstance, st.executeUpdate("UPDATE characters SET title_color = "+player.getAppearance().getTitlteColor()+" WHERE charId = "+player.getObjectId());

 

i was just bored to write the getters into the String

Edited by xdem
  • 0
Guest Elfocrash
Posted

where is the ?

 

both x u have the values from L2PcInstance, st.executeUpdate("UPDATE characters SET title_color = "+player.getAppearance().getTitlteColor()+" WHERE charId = "+player.getObjectId());

 

i was just bored to write the getters into the String

oh i though that you meant that you gonna have ? indicators and 

statement.setString(1, shit);

under the preparedstatement

 

Yeah it can be done as you wrote too, however it is way too unefficient

  • 0
Posted
 

Connection con = L2DatabaseFactory.getConnection();

Statement st = con.createStatement();

st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x");

 

the x are the getters u have to make from the l2PcInstance

 

code handwritten, maybe there are typos

you obviously need different query for something like that

  • 0
Posted

it works like a charm dude

1. It will change something, only if its previously inserted to character_variables table

2. "title_color" column name is wrong("val" is correct)

3. It will update all values of the character in that table, not only those regarding title.

  • 0
Posted

1. It will change something, only if its previously inserted to character_variables table

2. "title_color" column name is wrong("val" is correct)

3. It will update all values of the character in that table, not only those regarding title.

 

1. no

2. no

3. Nope

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • This has been happening for years now. That’s exactly why you don’t see many new people joining this forum anymore  most of the community has already moved elsewhere. MaxCheaters has been dying for years, and at this point it feels almost completely dead.  
    • First of all i don't use this account to do anything other than just reported that someone scammed me few bucks 3 days ago.  Second, who says i did scam, my name is ahead many topics because i had the most clients in the forum. Afcourse i had bad deals since 2017.    Also do i even know you? PM me if you have some issue do not write in public as if you are some savior or want maxcheaters owneship. 
    • 🔥 Lin2Web CMS Version 2.0 : New Engine! 🔥                 A fully rebuilt, fast and modern CMS for Lineage 2 servers. ✅ Player panel: game accounts, warehouse, send items to game, HWID/IP protection, unstuck ✅ Donate: 20+ payment systems (PayPal, Stripe, CoinPayments, CryptoCloud, FreeKassa and more) ✅ Services: name/gender change, karma clear, premium, item & skin transfer, starter packs ✅ Bonuses: promo codes, referrals, vote rewards, season, clan leader and streamer rewards ✅ Statistics: PvP/PK, clans, heroes, olympiad, castles, raid & epic bosses ✅ Live map with online players ✅ Events calendar, news, guides, FAQ ✅ Support ticket system ✅ UTM tracking for ads ✅ Full admin panel ✅ Multi-language, multi-server, custom themes   Site cms: Lin2Web.com   🖥 Supported Servers: L2J: Lucera2, L2J-Scripts, aCis, L2J-Eternity, L2JMobius, L2JFrozen, L2JSunrise, L2JHellas, PWSoft, Fandc, L2J Orion, and others PTS: Vanganth, Depmax64 (AdvExt), MyExt64   Telegram Discord
    • 🔥 Fresh batch ready! Buy 2, Get 1 Free deal is live on our shop. Instant delivery 24/7.
    • Dont try trash topic malaka 🙂
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..