Jump to content
  • 0
Takuyakii

query_sql update character name

Question

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
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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>{, ...}}});

 

Link to comment
Share on other sites

  • 0
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([email protected]$) + "' 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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0
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. 

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.