SA-MP Forums Archive
cant get string from db - 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: cant get string from db (/showthread.php?tid=532903)



cant get string from db - sarab_singh - 21.08.2014

Код:
public LoadCar(i)
{
	if(cache_get_row_count(ch))
	{
		VehInfo[i][Model] = cache_get_row_int(0, 1);
		VehInfo[i][X] = cache_get_row_float(0, 2);
		VehInfo[i][Y] = cache_get_row_float(0, 3);
		VehInfo[i][Z] = cache_get_row_float(0, 4);
		VehInfo[i][Angle] = cache_get_row_float(0, 5);
		VehInfo[i][Color] = cache_get_row_int(0, 6);
		VehInfo[i][Color2] = cache_get_row_int(0, 7);
		VehInfo[i][Ownable] = cache_get_row_int(0, 8);
		VehInfo[i][Owned] = cache_get_row_int(0, 9);
		cache_get_row(0, 10, VehInfo[i][Owner]);
		VehInfo[i][Rented] = cache_get_row_int(0, 11);
		cache_get_row(0, 12, VehInfo[i][Renter]);		
		VehInfo[i][Price] = cache_get_row_int(0, 13);
		VehInfo[i][RentPrice] = cache_get_row_int(0, 14);
		VehInfo[i][Locked] = cache_get_row_int(0, 15);
		VehInfo[i][VehId] = CreateVehicle(VehInfo[i][Model], VehInfo[i][X], VehInfo[i][Y], VehInfo[i][Z], VehInfo[i][Angle], VehInfo[i][Color], VehInfo[i][Color2], 60);
		new text[300];
		format(text, sizeof(text), "Model: %s\nOwner: %s\nRented by: %s\n", VehicleNames[VehInfo[i][Model] - 400], VehInfo[i][Owner], VehInfo[i][Renter]);
		VehInfo[i][Text] = Create3DTextLabel(text, COLOR_GREEN, VehInfo[i][X], VehInfo[i][Y], VehInfo[i][Z], 40, 0);
		Attach3DTextLabelToVehicle(VehInfo[i][Text], VehInfo[i][VehId], 0, 2, 0);
		SetVehicleNumberPlate(VehInfo[i][VehId], "RR");
	}
	return 1;
}



Re: cant get string from db - Vince - 21.08.2014

You need to explicitly state the string length if you want to load it directly into an enumerated array.