Save car color in a cfg file or player cfg?
#1

Hello!

Player can change car color in a service garage on my server, and i tried to save the color to player cfg. I only got "color=0" in the player cfg and color wasnt saved when restarted the server. So how can i make only 1 cfg file for all players with all colors saved with the /carcolor cmd?
The cmd needs to write/update to the cfg file i know that..but i dont know how. At least i was on the right way when i tried by my self first (i think)
i used [pColor] as the other things on the script..like [pWork] [pLeader] and so on. but like i said i only got "color=0" in the player cfg file.

So i guess it is best to make /carcolor cmd save in a own cfg file for ALL players?
Its only need to save for the owned house cars, and then i guess i need to remove all house cars from the script to a cfg file? Allt the cars also have a ID like this
Код:
public HouseCar(carid)
{
	if(carid >= 1 && carid <= 45)
	{
	  return 1;
	}
	return 0;
}
and that i really need help with
Код:
	if(strcmp(cmd, "/carcolor", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2385.1238,242.5568,26.4942))
{
new Color1[128];
new Color2[128];
new currentveh;
Color1 = strtok(cmdtext, idx);
Color2 = strtok(cmdtext, idx);
currentveh = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid, -200);
if (strval(Color1) > 255)
{
SendClientMessage(playerid, COLOR_RED, "Invalid Color ID 1");
return 1;
}
if (strval(Color2) > 255)
{
SendClientMessage(playerid, COLOR_RED, "Invalid Color ID 2");
return 1;
}
else
{
ChangeVehicleColor(currentveh, strval(Color1), strval(Color2));
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not at the service garage painting area!");
return 1;
}
return 0;
}
Reply
#2

first of all, i would like to ask why make an array of 128 when a color cannot be any longer than 4 symbols (more or less) ?
Reply
#3

Quote:
Originally Posted by Izanagi
first of all, i would like to ask why make an array of 128 when a color cannot be any longer than 4 symbols (more or less) ?
I didnt script that, im only modified it to fit my server service garage
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)