06.02.2010, 09:24
You can use these functions.
Also put this top of script:
And then in your /regplate command
Also put LoadPlates(); in OnGameModeInit.
pawn Код:
LoadPlates()
{
new line[256];
new Text3D:VText;
new File: file = fopen("carplates.cfg", io_read);
if (file)
{
new idx = 1;
while (fread(file, line))
{
format(CarPlate[idx], sizeof(CarPlate[]), line);
VText = Create3DTextLabel(CarPlate[idx],0x008080FF,0.0,0.0,0.0,20,0,1);
Attach3DTextLabelToVehicle(VText, idx, 0.0, 0.0, 0.0);
idx++;
}
fclose(file);
}
return 1;
}
pawn Код:
SavePlates()
{
new File: file = fopen("carplates.cfg", io_write);
new idx = 1;
while (idx < sizeof(CarPlate))
{
fwrite(file, CarPlate[idx]);
fwrite(file, "\r\n");
idx++;
}
fclose(file);
return 1;
}
pawn Код:
new CarPlate[MAX_VEHICLES][24];
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Text3D:VText;
format(CarPlate[vehicleid], sizeof(CarPlate[]), result);
VText = Create3DTextLabel(CarPlate[vehicleid],0x008080FF,0.0,0.0,0.0,20,0,1);
Attach3DTextLabelToVehicle(VText, vehicleid, 0.0, 0.0, 0.0);
SavePlates();
}