SetSpawnInfo and skin saving? -
Hargrave - 26.07.2013
Hey again!
I have been working with the register system on my new script (making a gamemode to learn scripting) and I am using SetSpawninfo on the register and login, so they will spawn at the same position all the time, but then they are also getting the skin changed to the skin I have choosen in SetPlayerSpawn.
I have made "pSkin" and fixed everything, but I cannot just put pSkin instead of the skin in SetSpawnInfo, then it won't work. What shall I do if I want the skin saved. They will spawn with one skin when they register (that would be skin ID0) and when they change their clothes (e.g by the account file that is getting saved) and if they then login, they will spawn with the same skin they had before they quit (except if it got edited in the account file .ini or whatever it's called).
How to do this?
Also
Quote:
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
|
I wrote INI_WriteInt(File,"Cash",5000); (want them to spawn with $5,000 when they are making an account) but it didn't work so I had to add:
Quote:
GivePlayerMoney(playerid, 5000);
|
Underneath, but that looks a bit stupid. Why isn't it possible to just write it in INI_WriteInt(File,"Cash",0);?
Thanks in advance.
Re: SetSpawnInfo and skin saving? -
Hargrave - 27.07.2013
Bump.
Re: SetSpawnInfo and skin saving? -
NotIntegrated - 27.07.2013
You can't do this because using INI_Int.. just loads the variable, it doesn't actually set the players cash to that. You would have to do the same thing with the skin. To give them the skin you saved, you need to set it when they spawn. This is from my GM, so the variables will be different but just edit it to fit your saving system.
Code:
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
Re: SetSpawnInfo and skin saving? -
Scottas - 27.07.2013
Quote:
Underneath, but that looks a bit stupid. Why isn't it possible to just write it in INI_WriteInt(File,"Cash",0);?
|
It's possible, you just need load that value from file if you want to use it. If you want to use skin which is save, then load skin value from file, store it 'pSkin' variable and then use that variable in SetSpawnInfo. If you still having issues with this, I would like to see more of your code if you need help.
Re: SetSpawnInfo and skin saving? -
Hargrave - 27.07.2013
Quote:
Originally Posted by Scottas
It's possible, you just need load that value from file if you want to use it. If you want to use skin which is save, then load skin value from file, store it 'pSkin' variable and then use that variable in SetSpawnInfo. If you still having issues with this, I would like to see more of your code if you need help.
|
Still have the same problem, do you have skype? Easier to show.
Re: SetSpawnInfo and skin saving? -
Scottas - 27.07.2013
I prefer helping in forums, than in private
Re: SetSpawnInfo and skin saving? -
Hargrave - 27.07.2013
I don't know what I shall past here and what's useful to post here, won't put the whole gamemode in there so.