SA-MP Forums Archive
[Ajuda] O que tem de errado com esse salvamento de casas? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] O que tem de errado com esse salvamento de casas? (/showthread.php?tid=626936)



O que tem de errado com esse salvamento de casas? - weex - 22.01.2017

Fiz o de carro e ta funcionando normal...
Mas o de casa e nгo salva de jeito nenhum, tem algo errado?

Код:
stock SalvarCasas() {
	for(new houseid = 1; houseid < MAX_HOUSES; houseid++) {
		new rows, fields;
		cache_get_row_count(rows);
		cache_get_field_count(fields);
		if(rows) {
			new query[1030];
		    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `houses` SET `hType` = '%d', `hOwner` = '%d', `hOutPosX` = '%f', `hOutPosY` = '%f', `hOutPosZ` = '%f', `hLocked` = '%d', `hAlarm` = '%d', `hMoney` = '%d', `hMaconha` = '%d', `hMaterial` = '%d', `FHQ` = '%d' WHERE `hID` = '%i'",
				HouseInfo[houseid][hType],
				HouseInfo[houseid][hOwner],
				HouseInfo[houseid][hOutPosX],
				HouseInfo[houseid][hOutPosY],
				HouseInfo[houseid][hOutPosZ],
				HouseInfo[houseid][hLocked],
				HouseInfo[houseid][hAlarm],
				HouseInfo[houseid][hMoney],
				HouseInfo[houseid][hMaconha],
				HouseInfo[houseid][hMaterial],
				HouseInfo[houseid][FHQ],
		    houseid);
		    mysql_pquery(ConnectMYSQL, query);
		}
	}
}



Re: O que tem de errado com esse salvamento de casas? - RodrigoMSR - 22.01.2017

Retire essa checagem de rows, jб que nгo tem nenhum query antes, ficando assim:
Код:
stock SalvarCasas() {
    new query[1030];
	for(new houseid = 1; houseid < MAX_HOUSES; houseid++) {
	    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `houses` SET `hType` = '%d', `hOwner` = '%d', `hOutPosX` = '%f', `hOutPosY` = '%f', `hOutPosZ` = '%f', `hLocked` = '%d', `hAlarm` = '%d', `hMoney` = '%d', `hMaconha` = '%d', `hMaterial` = '%d', `FHQ` = '%d' WHERE `hID` = '%i'",
			HouseInfo[houseid][hType],
			HouseInfo[houseid][hOwner],
			HouseInfo[houseid][hOutPosX],
			HouseInfo[houseid][hOutPosY],
			HouseInfo[houseid][hOutPosZ],
			HouseInfo[houseid][hLocked],
			HouseInfo[houseid][hAlarm],
			HouseInfo[houseid][hMoney],
			HouseInfo[houseid][hMaconha],
			HouseInfo[houseid][hMaterial],
			HouseInfo[houseid][FHQ],
	    houseid);
	    mysql_pquery(ConnectMYSQL, query);
	}
}



Re: O que tem de errado com esse salvamento de casas? - weex - 22.01.2017

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
Retire essa checagem de rows, jб que nгo tem nenhum query antes, ficando assim:
Код:
stock SalvarCasas() {
    new query[1030];
	for(new houseid = 1; houseid < MAX_HOUSES; houseid++) {
	    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `houses` SET `hType` = '%d', `hOwner` = '%d', `hOutPosX` = '%f', `hOutPosY` = '%f', `hOutPosZ` = '%f', `hLocked` = '%d', `hAlarm` = '%d', `hMoney` = '%d', `hMaconha` = '%d', `hMaterial` = '%d', `FHQ` = '%d' WHERE `hID` = '%i'",
			HouseInfo[houseid][hType],
			HouseInfo[houseid][hOwner],
			HouseInfo[houseid][hOutPosX],
			HouseInfo[houseid][hOutPosY],
			HouseInfo[houseid][hOutPosZ],
			HouseInfo[houseid][hLocked],
			HouseInfo[houseid][hAlarm],
			HouseInfo[houseid][hMoney],
			HouseInfo[houseid][hMaconha],
			HouseInfo[houseid][hMaterial],
			HouseInfo[houseid][FHQ],
	    houseid);
	    mysql_pquery(ConnectMYSQL, query);
	}
}
Mas eu li num tutorial que sempre tem que ter rows ao dar update, pq checa se tem essa coluna lб, se nгo pode dar merda, nгo й?


Re: O que tem de errado com esse salvamento de casas? - weex - 22.01.2017

Esqueci de comentar ontem, estб funcionando, mas /\