All pastes #963145 Raw Edit

Miscellany

public lua v1 · immutable
#963145 ·published 2008-03-30 07:37 UTC
rendered paste body
--go_turretsfunction createVehicle(vechid, plyr)	local vehicle = { }	local c = plyr:getCoords()	local test = g_arena:createVehicle(vechid, c.x, c.y, c.rotation)	test:setFrequency(plyr:frequency())	vehicle['id'] = test:id()	vehicle['vechid'] = test:typeid()	vehicle['x'] = c.x	vehicle['y'] = c.y	vehicle['rotation'] = c.rotation	vehicle['team'] = plyr.team	go_turrets[''..test:id()..''] = vehicleendfunction checkVehicleDeath(vech)	g_arena:message(''..vech:id())	local mytable = getn(go_turrets)	for i=1, table.getn(mytable) do		if (go_turrets[mytable[i]]['id'] == vech:id()) then			go_turrets[mytable[i]] = nil		end	end	endfunction saveObject_turrets()	exportTSF(go_turrets, 'turrets', 'turret')endfunction loadObject_turrets()	go_turrets = {}	go_turrets = importTSF('turrets', 'turret')endfunction buildTurrets()	local mytable = getn(go_turrets)	for i=1, table.getn(mytable) do		local vech = g_arena:createVehicle(go_turrets[mytable[i]]['vechid'], go_turrets[mytable[i]]['x'], go_turrets[mytable[i]]['y'], go_turrets[mytable[i]]['rotation'])		go_turrets[mytable[i]]['id'] = vech:id()	endendfunction checkTurretAssign(plyr)	local mytable = getn(go_turrets)	for i=1, table.getn(mytable) do		local vech = vehicleFromId(g_arena, go_turrets[mytable[i]]['id'])		if (go_turrets[mytable[i]]['team'] == plyr.team) then			vech:setFrequency(plyr:frequency())		end	endend