[HELP] Connect with last online Color
#1

I'm working on a RPG script and i wanted to make the Player name color save when the player disconnects/server restart.

Right now i have SetPlayerColor(playerid, COLOR_WHITE); - OnPlayerConnect | and i cant have the colors save if this is in the way because everytime the player connects, they have white color.

I want to know to to make it save for example, I have a blue color, and i leave the server, i come back and i still have a white color. Can you please help?

Thanks!
Reply
#2

You're going to have to use DINI / YINI or something else to write registered player's data to a notepad file / text editor file.

Before they disconnect, you would need to write to their userfile destination, like mysampserver\scriptfiles\userfiles\bobby234.sav or something.

You also need to make an enumeration (like PlayerInfo / pInfo / pData / etc...) and set those values to 1 (true) so the server knows you want to save their colour on disconnect.

This value will save into their userfile, therefore on next connect, the player colour should load from their userfile (the .sav notepad file).

Search around for some tutorials, hope you understood.
Reply
#3

I use Y_INI, how would i do the colors for that?
Reply
#4

Make it write a new line OnPlayerDisconnect with GetPlayerColor.

OnPlayerConnect, load the color, store it into a var, and SetPlayerColor(playerid, colorvar);
Reply
#5

Quote:
Originally Posted by Snipa
Посмотреть сообщение
Make it write a new line OnPlayerDisconnect with GetPlayerColor.

OnPlayerConnect, load the color, store it into a var, and SetPlayerColor(playerid, colorvar);
Exactly! but i want to also save it into Y_INI if thats effecient, someway for the script to know your old color. Like read job color on Y_INI file and load it.

and i dont really know how to do the code
Reply
#6

Good luck.
Reply
#7

Thanks, well if anyone has a code to do this would be nice
Reply
#8

Still in need of some help if possible
Reply
#9

Sorry, I don't know how to use Y_INI , I use DINI
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)