Ein kleiner c&p aus meinem Code:
Code:
var hSpawnfile = file_open_read(strDatFile);
STRING *strSpawnList = str_create("#1024");

int i;
for(i = 0; i < 1024; i++)
{
	if(file_str_read(hSpawnfile, strSpawnList) == -1)
		break;
	
	var tempCnt = 0;
	var vTemp[3];
	
	while(true)
	{
		var sym = str_stri(strSpawnList, ";");
		if(!sym)
			break;
		
		STRING *strTmp = str_create("#16");
		str_cpy(strTmp, strSpawnList);
		str_clip(strSpawnList, sym);
		str_trunc(strTmp, str_len(strTmp) - sym + 1);
		
		if(tempCnt <= 2)//Vector hat 3 Zeichen (<=2) und danach kommt das team.
		{
			vTemp[tempCnt] = str_to_num(strTmp);
			tempCnt++;
		}
		else//Erstellt die entity am zuvor ausgelesenen vector
		{
			ENTITY *entTmp = ent_create(NULL, vTemp, net_SpawnPoint);
			entTmp.skill1 = str_to_num(strTmp); //Team
			tempCnt = 0;
		}
		
		str_remove(strTmp);
	}
	
	file_close(hSpawnfile);
}



Er liest für jeden Vector das team aus einer dat-datei aus. Meine dat-datei:
Code:
1334;937;-669;0;1476;934;-669;0;1257;854;-669;0;1381;774;-669;0;1046;731;-669;0;-616;-2028;-370;1;-833;-1963;-370;1;215;-2081;-427;1;67;-2156;-492;1;



Layout ist x;y;z;team

Last edited by Ch40zzC0d3r; 11/27/13 19:34.