addEventHandler( "onResourceStart", resourceRoot,
function()
--create cuboids
local fX, fY, fZ;
for index, value in pairs( Turfids ) do --TODO: Might not work if table is indexed
fX, fY, fZ = value[1], value[2], value[3] -- less code in params means better organization
local cCuboid = createColCuboid( fX, fY, fZ, 10, 10, 10 );
if cCuboid then
--add handlers
addEventHandler( "onColShapeHit", cCuboid, cuboidHit, false );
end
end
end
)
function cuboidHit( p )
--check whether the player is turfing already or not (what?)
if getElementData( p, "YouAreTurfing" ) then
outputChatBox( "You are already turfing!", p, 255, 0, 0, false )
return
end
--some random debug code
outputChatBox( "blablabla", p, 0, 255, 255, false )
--turf shit
setElementData( player, "YouAreTurfing", true )
triggerClientEvent( player, "tn:Turfing", root )
setRadarAreaFlashing( pArea, true )
local theMoney = math.random(2580, 4930)
TurfTimers[ p ] = setTimer(
function()
--some code
end,
300000, 1)
end
Not tested.