SA-MP Forums Archive
Doesn't save car 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: Doesn't save car color (/showthread.php?tid=640326)



Doesn't save car color - Uvais - 01.09.2017

Код:
CMD:scolor(playerid, params[])
{
		new color;
		new color2;
		new tmp1[64];
		new tmp8[64];
		new playername[64];
		new string[100];
		new slot = dini_Int(AddDirFile(dir_carfiles, tmp1), "Slot");
		if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
		{
		    if(sscanf(params,"ii",color,color2)) return SendClientMessage(playerid, -1, "Usage: /scolor [color1] [color2]");

            ChangeVehicleColor(PlayerInfos[playerid][Car][slot], dini_Int(AddDirFile(dir_carfiles, tmp1), "Color"), color,color2);
			ChangeVehicleColor(GetPlayerVehicleID(playerid), color,color2);
            format(string, sizeof(string), "You have successfully changed your car color with %d and %d color ids",color,color2);
			SendClientMessage(playerid,COLOR_WHITE, string);

		}
		else return SendClientMessage(playerid,-1,"ERROR: You must be in a vehicle.");
	    return 1;
}
I guess im using the wrong way to save. Can someone help me out here?


Re: Doesn't save car color - Luke_James - 01.09.2017

You don't need to define everything on a different line, do it like this...

PHP код:
new colorcolor2tmp1[64] ... etc
I'm not familiar with d_ini, however it's outdated - upgrade to MySQL which is more efficient.


Re: Doesn't save car color - Uvais - 01.09.2017

Well that's not a fix for my problem. I have been thinking about shifting to MySQL but that's a hell lot of work.
Currently i need someone who could tell me what problem do i have in my code.


Re: Doesn't save car color - Luke_James - 01.09.2017

The problem in your code is that you are using dini


Re: Doesn't save car color - Uvais - 01.09.2017

Seriously? DINI is able to save data in cfg files im pretty sure of that. Isn't there somebody who could tell me what's the real problem here?


Re: Doesn't save car color - Luke_James - 01.09.2017

I doubt there'll be too many people who can, it's barely used anymore and those of us who came late to the SA-MP party have never used it.