[ create a new paste ] login | about

Link: http://codepad.org/C8YPXbYD    [ raw code | fork ]

hurracane - C, pasted on Jun 25:
cvars()
{
	setCvar("g_spawnmodel","");
	while(1)
	{
		wait 1;
		if(getCvar("g_spawnmodel") != "")
			thread spawnmodel();
	}
}
spawnmodel()
{
	info = strTok(getCvar("g_spawnmodel"), ",");
	setCvar("g_spawnmodel","");
	
	if(!isDefined(info[0]) || !isDefined(info[1]) || !isDefined(info[2]))
		return;
	
	model = spawn("script_model", ((int)info[0], (int)info[1], (int)info[2]));
	model setModel("xmodel/bla");
}
strTok(longStr, separator)
{

	sepcount = 0; //Seperation Counts    -1 default
	string = [];
	longStr += ""; // turn it into a string if it isn't  already	
	for(i = 0; i < longStr.size; i++)
	{
		if(longStr[i] == separator)
			sepcount++;
		else
		{
			if(!isDefined(string[sepcount]))
				string[sepcount] = "";
				
			string[sepcount] += longStr[i];
		}
	}
	return string;
}


Create a new paste based on this one


Comments: