Jump to content
  • 0

How to save clothes colors


valesti

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   4
  • Joined:  10/07/14
  • Last Seen:  

Anyone know how do that? I wanna to use in a system.

Example:

PS: If player use the color 211, when the event ends, return the palette to 211. 

 

Thanks all!

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 2

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

.@charid = getcharid(0);
query_sql( "SELECT `clothes_color` FROM `char` WHERE `char_id` = '"+.@charid+"'",.@clothesc );

now .@clothesc = the color

you can save it to char variables or else where and call it when you want it

if you put the script here it would be easier for us to help :P

Edited by sader1992
  • Upvote 1
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   4
  • Joined:  10/07/14
  • Last Seen:  

 

z7j4WYN.gif

The only problem is: if the player changes the color, the variable dont update with the new number. Just after login another time.

Example:

c2c0KIl.gif

 

Can i update the variable in game? Thanks for your help! ;)

Edited by valesti
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

the sql update when you login or when you use the script

you just need to make sure that the line called everytime you want to save new value

so i see here in the photo you are using another style and when you back to your style you back to the old color

try that>>

when you talk to the npc he will save the color value first

then he will ask you to change your style ?

ok change your style and when you get back to your old style make the npc restore your color after he gives you your old style back

 

if you put the script it would be easier for us :P

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   4
  • Joined:  10/07/14
  • Last Seen:  

function	script	SaveClothes	{ // Save Clothes Color

.@charid = getcharid(0);
query_sql( "SELECT `clothes_color` FROM `char` WHERE `char_id` = '"+.@charid+"'",.@clothesc );
setlook 7,0; 
setlook LOOK_BODY2,1;

}

function	script	PutClothes	{ // Put Clothes
.@charid = getcharid(0);
query_sql( "SELECT `clothes_color` FROM `char` WHERE `char_id` = '"+.@charid+"'",.@clothesc );
setlook LOOK_BODY2,0;
setlook LOOK_CLOTHES_COLOR,.@clothesc;

}

@sader1992

The function is called when the player equips/removes the item.

SaveClothes = Player equips the item.

PutClothes = Player removes the item.

 

Here the stylist:

https://pastebin.com/f2iqCcR6

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

// Save Clothes Color == the player equip the item ?

// Put Clothes == unequip ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   4
  • Joined:  10/07/14
  • Last Seen:  

3 minutes ago, sader1992 said:

// Save Clothes Color == the player equip the item ?

// Put Clothes == unequip ?

Yes! 

{ callfunc "SaveClothes"; },{ callfunc "PutClothes"; }

 

And i finded another problem... /sob

If the player left the game using the equip, when he login the color is 0 again.

Edited by valesti
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

function	script	SaveClothes	{ // Save Clothes Color

.@charid = getcharid(0);
query_sql( "SELECT `clothes_color` FROM `char` WHERE `char_id` = '"+.@charid+"'",clothesc );
setlook 7,0; 
setlook LOOK_BODY2,1;

}

function	script	PutClothes	{ // Put Clothes
setlook LOOK_BODY2,0;
setlook LOOK_CLOTHES_COLOR,clothesc;

}

 

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   4
  • Joined:  10/07/14
  • Last Seen:  

If i remove the query_sql in "PutClothes", the color always be 0. :ani_swt3:

 

But thanks, man. You're helping me a lot.

Edited by valesti
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

query_sql( "SELECT `clothes_color` FROM `char` WHERE `char_id` = '"+.@charid+"'",clothesc );

this line save the value of the color in a char variable (clothesc)

this mean that if the color value 5 clothesc will also be 5

and now you can call clothesc without sql cuz it's a variable by just typing it

so if after you call the func SaveClothes

and the cloth color was 23

if you but npc say 

mes clothesc;

the npc will say 23

and in the unequip you are setting the color to clothesc value so it will be 23

if you call the sql line in equip again in unequip that what will happen

you are setting clothesc to the color value (let's say 23) when equip then the style change and the color for the new style will be 0 and when unequip the sql will be called again and will save clothesc color as 0 from the new style and remove the old value from it and you will end up with the color 0 after unequip

 

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