Quote:
Originally Posted by TaLhA XIV
Save player car ids when player disconnects.I think that if a player sell's the car,the script does not save that new stats.
|
OnPlayerDisconnect code
Код:
public OnPlayerDisconnect(playerid, reason)
{
TextDrawDestroy(CoSTD0[playerid]);
TextDrawDestroy(AlarmTD0[playerid]);
TextDrawDestroy(AlarmTD1[playerid]);
new
pFile[35];
format(pFile, 35, Player_File, GetName(playerid));
new
INI:UserFile = INI_Open(pFile);
INI_WriteInt(UserFile, "Veh1", Player[playerid][Veh1]);
INI_WriteInt(UserFile, "Veh2", Player[playerid][Veh2]);
INI_Close(UserFile);
return 1;
}
OnPlayerConnect code, where is problem?
Код:
public OnPlayerConnect(playerid)
{
CoSTD0[playerid] = TextDrawCreate(215.000000, 380.000000, "~y~Naziv: ~w~Cheetah ~y~Cijena: ~g~$5~n~ ~y~Maximalna brzina: ~w~200");
TextDrawBackgroundColor(CoSTD0[playerid], 255);
TextDrawFont(CoSTD0[playerid], 2);
TextDrawLetterSize(CoSTD0[playerid], 0.370000, 1.000000);
TextDrawColor(CoSTD0[playerid], -1);
TextDrawSetOutline(CoSTD0[playerid], 1);
TextDrawSetProportional(CoSTD0[playerid], 1);
AlarmTD0[playerid] = TextDrawCreate(40.000000, 150.000000, "~n~");
TextDrawBackgroundColor(AlarmTD0[playerid], 255);
TextDrawFont(AlarmTD0[playerid], 1);
TextDrawLetterSize(AlarmTD0[playerid], 0.360000, 3.300000);
TextDrawColor(AlarmTD0[playerid], -1);
TextDrawSetOutline(AlarmTD0[playerid], 0);
TextDrawSetProportional(AlarmTD0[playerid], 1);
TextDrawSetShadow(AlarmTD0[playerid], 1);
TextDrawUseBox(AlarmTD0[playerid], 1);
TextDrawBoxColor(AlarmTD0[playerid], -206);
TextDrawTextSize(AlarmTD0[playerid], 117.000000, 0.000000);
AlarmTD1[playerid] = TextDrawCreate(40.000000, 150.000000, "~p~~h~Alarm: ~r~ON~n~~n~~p~~h~Alarm: ~w~OFF");
TextDrawBackgroundColor(AlarmTD1[playerid], 255);
TextDrawFont(AlarmTD1[playerid], 2);
TextDrawLetterSize(AlarmTD1[playerid], 0.290000, 0.899999);
TextDrawColor(AlarmTD1[playerid], -1);
TextDrawSetOutline(AlarmTD1[playerid], 1);
TextDrawSetProportional(AlarmTD1[playerid], 1);
new pFile[48];
format(pFile, 48, Player_File, GetName(playerid));
if(!fexist(pFile))
{
new
INI:UserFile = INI_Open(pFile);
INI_WriteInt(UserFile, "Veh1",9999);
INI_WriteInt(UserFile, "Veh2", 9999);
INI_Close(UserFile);
}
INI_ParseFile(pFile, "LoadPlayerData", .bExtra = true, .extra = playerid);
Priceo[playerid] = 0;
Seller[playerid] = 999;
return 1;
}