Jump to content
  • 0

query_sql update character name


Question

Posted (edited)

Hello,

 

can someone help me make this work ?

query_sql "UPDATE `char` SET name='[Dark Army] "+ escape_sql(@charname$) + "' WHERE `char_id`="+escape_sql(@charid$)+"";
i have an npc that can change your name, but the sql script not working.

 

i found that sql wayback 2013 i gueess, 

Edited by Takuyakii

5 answers to this question

Recommended Posts

  • 0
Posted

For starters, please change the topic title - it's not as descriptive as it could be.

Second, why is your script using a string variable for an integer? (charid)

How are you setting these variables?

Missing parenthesis:

Quote
query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});

 

  • 0
Posted
Just now, Akkarin said:

For starters, please change the topic title - it's not as descriptive as it could be.

Second, why is your script using a string variable for an integer? (charid)

How are you setting these variables?

Missing parenthesis:

 

Thank you sir,  i tryd to searched and found out about something 
so i did  

query_sql "UPDATE `char` SET name='[Dark Army] "+ escape_sql(.@charname$) + "' WHERE `char_id`='"+getcharid(0)+"'";

and now its working, now i have a second problem, how can i maintain their original name?
i would just like if they change name their original name will still exist, but in front of original name "Dark army" will show. 
[Dark Army] Takuyakii.

Sorry for my title i just don't know what should i wrote. again sorry Sir.

  • 0
Posted

You could instead just use @fakename to apply the change so it doesn't change anything in the database.

OnPCLoginEvent:
atcommand "@fakename [Dark Army] "+ strcharinfo(0);
end;

The fakename atcommand is visual only and lasts until the player logs out.

  • 0
Posted
Just now, Akkarin said:

You could instead just use @fakename to apply the change so it doesn't change anything in the database.

OnPCLoginEvent:
atcommand "@fakename [Dark Army] "+ strcharinfo(0);
end;

The fakename atcommand is visual only and lasts until the player logs out.

i tried but if i use @fakename, they can't invite him into party. or guild nor duel. 

  • 0
Posted

Alright then, if you want to do something complicated, you will need to create a separate column in the char table and update that column with the player's name before changing it. 

  • Love 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...