SA-MP Forums Archive
[HELP] Connect with last online Color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Connect with last online Color (/showthread.php?tid=291238)



[HELP] Connect with last online Color - Arsham7 - 18.10.2011

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!


Re: [HELP] Connect with last online Color - grand.Theft.Otto - 19.10.2011

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.


Re: [HELP] Connect with last online Color - Arsham7 - 19.10.2011

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


Re: [HELP] Connect with last online Color - Snipa - 19.10.2011

Make it write a new line OnPlayerDisconnect with GetPlayerColor.

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


Re: [HELP] Connect with last online Color - Arsham7 - 19.10.2011

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


Re: [HELP] Connect with last online Color - Hordan - 19.10.2011

Good luck.


Re: [HELP] Connect with last online Color - Arsham7 - 19.10.2011

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


Re: [HELP] Connect with last online Color - Arsham7 - 19.10.2011

Still in need of some help if possible


Re: [HELP] Connect with last online Color - grand.Theft.Otto - 19.10.2011

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